mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 20:46:23 +03:00
backend: добавили состояния персонажей
This commit is contained in:
41
backend/migrations/versions/4ab34de53087_.py
Normal file
41
backend/migrations/versions/4ab34de53087_.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 4ab34de53087
|
||||
Revises: 1da93403ba52
|
||||
Create Date: 2022-11-20 12:22:55.594622
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4ab34de53087'
|
||||
down_revision = '1da93403ba52'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('character_states',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
with op.batch_alter_table('characters', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('state_id', sa.Integer(), nullable=False))
|
||||
batch_op.create_foreign_key(None, 'character_states', ['state_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('characters', schema=None) as batch_op:
|
||||
batch_op.drop_constraint(None, type_='foreignkey')
|
||||
batch_op.drop_column('state_id')
|
||||
|
||||
op.drop_table('character_states')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user