Files
whisperbox-transcribe/app/alembic/versions/54824f17a11d_add_account_table.py
2022-12-27 11:35:08 +01:00

47 lines
1.4 KiB
Python

"""add_account_table
Revision ID: 54824f17a11d
Revises:
Create Date: 2022-12-18 17:51:09.172531
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "54824f17a11d"
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"accounts",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column(
"created_at",
sa.DateTime(),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.Column("api_key", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("name", sa.String(length=256), nullable=True),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("name"),
)
op.create_index(op.f("ix_accounts_api_key"), "accounts", ["api_key"], unique=False)
op.create_index(op.f("ix_accounts_id"), "accounts", ["id"], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_accounts_id"), table_name="accounts")
op.drop_index(op.f("ix_accounts_api_key"), table_name="accounts")
op.drop_table("accounts")
# ### end Alembic commands ###