DB migration

This commit is contained in:
Oleg Lavrovsky 2024-03-11 17:01:05 +01:00
parent 9e817dec5d
commit d99bba7d90
No known key found for this signature in database
GPG Key ID: 31E523030632FF4B
1 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,80 @@
"""Event aftersubmit, increased hashtag, summary
Revision ID: 2e16efec66e4
Revises: 2b948713686c
Create Date: 2024-03-11 17:00:00.739345
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2e16efec66e4'
down_revision = '2b948713686c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('events', schema=None) as batch_op:
batch_op.add_column(sa.Column('aftersubmit', sa.UnicodeText(), nullable=True))
with op.batch_alter_table('projects', schema=None) as batch_op:
batch_op.add_column(sa.Column('ident', sa.String(length=10), nullable=True))
batch_op.alter_column('hashtag',
existing_type=sa.VARCHAR(length=40),
type_=sa.String(length=140),
existing_nullable=True)
batch_op.alter_column('summary',
existing_type=sa.VARCHAR(length=140),
type_=sa.String(length=2048),
existing_nullable=True)
with op.batch_alter_table('projects_version', schema=None) as batch_op:
batch_op.add_column(sa.Column('ident', sa.String(length=10), autoincrement=False, nullable=True))
batch_op.alter_column('hashtag',
existing_type=sa.VARCHAR(length=40),
type_=sa.String(length=140),
existing_nullable=True,
autoincrement=False)
batch_op.alter_column('summary',
existing_type=sa.VARCHAR(length=140),
type_=sa.String(length=2048),
existing_nullable=True,
autoincrement=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('projects_version', schema=None) as batch_op:
batch_op.alter_column('summary',
existing_type=sa.String(length=2048),
type_=sa.VARCHAR(length=140),
existing_nullable=True,
autoincrement=False)
batch_op.alter_column('hashtag',
existing_type=sa.String(length=140),
type_=sa.VARCHAR(length=40),
existing_nullable=True,
autoincrement=False)
batch_op.drop_column('ident')
with op.batch_alter_table('projects', schema=None) as batch_op:
batch_op.alter_column('summary',
existing_type=sa.String(length=2048),
type_=sa.VARCHAR(length=140),
existing_nullable=True)
batch_op.alter_column('hashtag',
existing_type=sa.String(length=140),
type_=sa.VARCHAR(length=40),
existing_nullable=True)
batch_op.drop_column('ident')
with op.batch_alter_table('events', schema=None) as batch_op:
batch_op.drop_column('aftersubmit')
# ### end Alembic commands ###