-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
backend/app/alembic/versions/80580dd7587b_add_three_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""add three tables | ||
Revision ID: 80580dd7587b | ||
Revises: 1a31ce608336 | ||
Create Date: 2024-12-05 16:24:28.872367 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
import sqlmodel.sql.sqltypes | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '80580dd7587b' | ||
down_revision = '1a31ce608336' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('todo', | ||
sa.Column('title', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False), | ||
sa.Column('desc', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=True), | ||
sa.Column('id', sa.Uuid(), nullable=False), | ||
sa.Column('user_id', sa.Uuid(), nullable=False), | ||
sa.Column('status', sqlmodel.sql.sqltypes.AutoString(length=20), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table('subtodo', | ||
sa.Column('title', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False), | ||
sa.Column('desc', sqlmodel.sql.sqltypes.AutoString(length=255), nullable=True), | ||
sa.Column('id', sa.Uuid(), nullable=False), | ||
sa.Column('todo_id', sa.Uuid(), nullable=False), | ||
sa.Column('status', sqlmodel.sql.sqltypes.AutoString(length=20), nullable=False), | ||
sa.ForeignKeyConstraint(['todo_id'], ['todo.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('subtodo') | ||
op.drop_table('todo') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters