create user table

This commit is contained in:
s.mostryukov 2024-10-02 12:50:33 +03:00
parent 404f3757b4
commit bc198d12ec
1 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
"""add user table
Revision ID: 756bbba724e8
Revises:
Create Date: 2024-10-02 12:35:15.382899
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "756bbba724e8"
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("name", sa.String(), nullable=True),
sa.Column("tg_id", sa.BigInteger(), nullable=True),
sa.Column("email", sa.String(length=320), nullable=False),
sa.Column("hashed_password", sa.String(length=1024), nullable=False),
sa.Column("is_active", sa.Boolean(), nullable=False),
sa.Column("is_superuser", sa.Boolean(), nullable=False),
sa.Column("is_verified", sa.Boolean(), nullable=False),
sa.PrimaryKeyConstraint("id", name=op.f("pk_users")),
)
op.create_index(op.f("ix_users_email"), "users", ["email"], unique=True)
def downgrade() -> None:
op.drop_index(op.f("ix_users_email"), table_name="users")
op.drop_table("users")