use alembic

This commit is contained in:
sergey 2024-07-11 21:56:42 +03:00
parent 8a567298bc
commit afdc8e30ca
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
"""create users table
Revision ID: f4b761edb8cd
Revises:
Create Date: 2024-07-11 21:53:59.445637
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "f4b761edb8cd"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
"users",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("username", sa.String(), nullable=False),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("username"),
)
def downgrade() -> None:
op.drop_table("users")