mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 04:26:23 +03:00
backend: добавлены базовые модели классов, расс и персонажей
This commit is contained in:
51
backend/migrations/versions/4126152c5668_.py
Normal file
51
backend/migrations/versions/4126152c5668_.py
Normal file
@@ -0,0 +1,51 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 4126152c5668
|
||||
Revises: 8f02337dbef0
|
||||
Create Date: 2022-11-18 18:46:52.576544
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '4126152c5668'
|
||||
down_revision = '8f02337dbef0'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('character_classes',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('character_races',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('characters',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('owner', sa.Integer(), nullable=True),
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.Column('character_race', sa.Integer(), nullable=True),
|
||||
sa.Column('character_class', sa.Integer(), nullable=True),
|
||||
sa.Column('created_on', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['character_class'], ['character_classes.id'], ),
|
||||
sa.ForeignKeyConstraint(['character_race'], ['character_races.id'], ),
|
||||
sa.ForeignKeyConstraint(['owner'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('characters')
|
||||
op.drop_table('character_races')
|
||||
op.drop_table('character_classes')
|
||||
# ### end Alembic commands ###
|
||||
54
backend/migrations/versions/5aef83a8a42f_.py
Normal file
54
backend/migrations/versions/5aef83a8a42f_.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 5aef83a8a42f
|
||||
Revises: 4126152c5668
|
||||
Create Date: 2022-11-18 19:18:39.496655
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5aef83a8a42f'
|
||||
down_revision = '4126152c5668'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('characters', schema=None) as batch_op:
|
||||
batch_op.alter_column('owner',
|
||||
existing_type=mysql.INTEGER(),
|
||||
nullable=False)
|
||||
batch_op.alter_column('name',
|
||||
existing_type=mysql.VARCHAR(length=255),
|
||||
nullable=False)
|
||||
batch_op.alter_column('character_race',
|
||||
existing_type=mysql.INTEGER(),
|
||||
nullable=False)
|
||||
batch_op.alter_column('character_class',
|
||||
existing_type=mysql.INTEGER(),
|
||||
nullable=False)
|
||||
|
||||
# ### 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.alter_column('character_class',
|
||||
existing_type=mysql.INTEGER(),
|
||||
nullable=True)
|
||||
batch_op.alter_column('character_race',
|
||||
existing_type=mysql.INTEGER(),
|
||||
nullable=True)
|
||||
batch_op.alter_column('name',
|
||||
existing_type=mysql.VARCHAR(length=255),
|
||||
nullable=True)
|
||||
batch_op.alter_column('owner',
|
||||
existing_type=mysql.INTEGER(),
|
||||
nullable=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user