|
| 1 | +"""Added users models. |
| 2 | +
|
| 3 | +Revision ID: 8caca4abd7b4 |
| 4 | +{%- if cookiecutter.add_dummy == 'True' %} |
| 5 | +Revises: 2b7380507a71 |
| 6 | +{%- else %} |
| 7 | +Revises: 819cbf6e030b |
| 8 | +{%- endif %} |
| 9 | +Create Date: 2026-05-05 14:37:30.629187 |
| 10 | +
|
| 11 | +""" |
| 12 | + |
| 13 | +import sqlalchemy as sa |
| 14 | +from alembic import op |
| 15 | +import fastapi_users_db_sqlalchemy.generics |
| 16 | +import fastapi_users_db_sqlalchemy |
| 17 | + |
| 18 | +# revision identifiers, used by Alembic. |
| 19 | +revision = "8caca4abd7b4" |
| 20 | +down_revision = "2b7380507a71" |
| 21 | +{%- if cookiecutter.add_dummy == 'True' %} |
| 22 | +down_revision = "2b7380507a71" |
| 23 | +{%- else %} |
| 24 | +down_revision = "819cbf6e030b" |
| 25 | +{%- endif %} |
| 26 | +branch_labels = None |
| 27 | +depends_on = None |
| 28 | + |
| 29 | + |
| 30 | +def upgrade() -> None: |
| 31 | + """Run the migration.""" |
| 32 | + # ### commands auto generated by Alembic - please adjust! ### |
| 33 | + op.create_table( |
| 34 | + "user", |
| 35 | + sa.Column("id", fastapi_users_db_sqlalchemy.generics.GUID(), nullable=False), |
| 36 | + sa.Column("email", sa.String(length=320), nullable=False), |
| 37 | + sa.Column("hashed_password", sa.String(length=1024), nullable=False), |
| 38 | + sa.Column("is_active", sa.Boolean(), nullable=False), |
| 39 | + sa.Column("is_superuser", sa.Boolean(), nullable=False), |
| 40 | + sa.Column("is_verified", sa.Boolean(), nullable=False), |
| 41 | + sa.PrimaryKeyConstraint("id"), |
| 42 | + ) |
| 43 | + op.create_index(op.f("ix_user_email"), "user", ["email"], unique=True) |
| 44 | + # ### end Alembic commands ### |
| 45 | + |
| 46 | + |
| 47 | +def downgrade() -> None: |
| 48 | + """Undo the migration.""" |
| 49 | + # ### commands auto generated by Alembic - please adjust! ### |
| 50 | + op.drop_index(op.f("ix_user_email"), table_name="user") |
| 51 | + op.drop_table("user") |
| 52 | + # ### end Alembic commands ### |
0 commit comments