mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-10 08:05:22 +02:00
48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
"""Add user model
|
|
|
|
Revision ID: 1d441e79db94
|
|
Revises: 2d6e2f41caa2
|
|
Create Date: 2025-04-16 17:40:04.699129
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "1d441e79db94"
|
|
down_revision: Union[str, None] = "2d6e2f41caa2"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"users",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("provider_id", sa.String(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index(op.f("ix_users_id"), "users", ["id"], unique=False)
|
|
op.create_index(op.f("ix_users_provider_id"), "users", ["provider_id"], unique=True)
|
|
op.add_column("livekit_rooms", sa.Column("user_id", sa.Integer(), nullable=True))
|
|
op.create_foreign_key(None, "livekit_rooms", "users", ["user_id"], ["id"])
|
|
op.add_column("workflows", sa.Column("user_id", sa.Integer(), nullable=True))
|
|
op.create_foreign_key(None, "workflows", "users", ["user_id"], ["id"])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint(None, "workflows", type_="foreignkey")
|
|
op.drop_column("workflows", "user_id")
|
|
op.drop_constraint(None, "livekit_rooms", type_="foreignkey")
|
|
op.drop_column("livekit_rooms", "user_id")
|
|
op.drop_index(op.f("ix_users_provider_id"), table_name="users")
|
|
op.drop_index(op.f("ix_users_id"), table_name="users")
|
|
op.drop_table("users")
|
|
# ### end Alembic commands ###
|