def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( 'story_localization', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('story_id', sa.Integer(), nullable=False), sa.Column('name', sa.Unicode(length=1024), server_default='', nullable=False), sa.Column('description', sa.Unicode(length=4096), server_default='', nullable=False), sa.Column('language', sa.Unicode(length=5), server_default='zh-HK', nullable=False), sa.Column('cover_storage', pyramid_safile.FileHandleStore(length=255), nullable=True), sa.Column('og_image', pyramid_safile.FileHandleStore(length=255), nullable=True), sa.ForeignKeyConstraint( ['story_id'], ['story.id'], ), sa.PrimaryKeyConstraint('id')) op.create_index('storylocalization_oice_language_idx', 'story_localization', ['story_id', 'language'], unique=False) op.create_table( 'oice_localization', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('oice_id', sa.Integer(), nullable=False), sa.Column('filename', sa.Unicode(length=1024), server_default='', nullable=False), sa.Column('language', sa.Unicode(length=5), server_default='zh-HK', nullable=False), sa.ForeignKeyConstraint( ['oice_id'], ['oice.id'], ), sa.PrimaryKeyConstraint('id')) op.create_index('oicelocalization_oice_language_idx', 'oice_localization', ['oice_id', 'language'], unique=False) op.add_column( 'oice', sa.Column('language', sa.Unicode(length=5), server_default='zh-HK', nullable=False)) op.drop_column('oice', 'og_locale')
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column( 'asset', sa.Column('is_deleted', sa.Boolean(), server_default=sa.text('0'), nullable=False)) op.alter_column('asset', 'name', new_column_name='name_en', existing_type=sa.Unicode(length=1024), existing_nullable=False) op.add_column( 'asset', sa.Column('name_jp', sa.Unicode(length=1024), nullable=False)) op.add_column( 'asset', sa.Column('name_tw', sa.Unicode(length=1024), nullable=False)) conn = op.get_bind() conn.execute(""" UPDATE asset SET name_jp = name_en; UPDATE asset SET name_tw = name_en;""") op.add_column( 'character', sa.Column('is_deleted', sa.Boolean(), server_default=sa.text('0'), nullable=False)) op.add_column( 'library', sa.Column('cover_storage', pyramid_safile.FileHandleStore(length=255), nullable=True)) op.add_column( 'library', sa.Column('description', sa.Unicode(length=4096), server_default='', nullable=False)) op.add_column( 'library', sa.Column('is_public', sa.Boolean(), server_default=sa.text('0'), nullable=False)) op.add_column( 'library', sa.Column('license', sa.SmallInteger(), server_default='0', nullable=False)) op.add_column( 'story', sa.Column('cover_storage', pyramid_safile.FileHandleStore(length=255), nullable=True))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column( 'story', sa.Column('hero_image', pyramid_safile.FileHandleStore(length=255), nullable=True)) op.add_column( 'story', sa.Column('title_logo', pyramid_safile.FileHandleStore(length=255), nullable=True))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('oice', sa.Column('id', sa.Integer(), nullable=False), sa.Column('filename', sa.Unicode(length=1024), nullable=False, server_default=""), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=False), sa.Column('is_deleted', sa.Boolean(), nullable=False, server_default="0"), sa.Column('uuid', sa.Unicode(length=32), nullable=False, server_default=''), sa.Column('poll_id', sa.Integer(), nullable=True), sa.Column('is_show_ad', sa.Boolean(), nullable=False, server_default="1"), sa.Column('og_description', sa.Unicode(length=1024), nullable=False, server_default=""), sa.Column('og_image', pyramid_safile.FileHandleStore(length=255), nullable=True), sa.Column('og_locale', sa.Unicode(length=5), server_default="zh_HK", nullable=False), sa.Column('order', sa.Integer(), nullable=False), sa.Column('story_id', sa.Integer(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uuid'), mysql_engine='InnoDB') conn = op.get_bind() conn.execute(""" INSERT oice SELECT * FROM ks""") op.drop_constraint('block_ibfk_1', 'block', type_='foreignkey') op.drop_constraint('project_export_ibfk_2', 'project_export', type_='foreignkey') op.drop_table('ks') op.create_foreign_key(None, 'project_export', 'oice', ['ks_id'], ['id']) op.add_column('block', sa.Column('oice_id', sa.Integer(), nullable=False)) conn = op.get_bind() conn.execute(""" UPDATE block SET oice_id = ks_id;""") op.create_foreign_key(None, 'block', 'oice', ['oice_id'], ['id']) op.drop_column('block', 'ks_id')
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('oice', sa.Column('description', sa.Unicode(length=1024), server_default='', nullable=False)) op.add_column('oice', sa.Column('image', pyramid_safile.FileHandleStore(length=255), nullable=True)) op.add_column('oice', sa.Column('og_title', sa.Unicode(length=1024), server_default='', nullable=False)) conn = op.get_bind() conn.execute(""" UPDATE oice SET description = og_description;""") conn.execute(""" UPDATE oice SET og_title = filename;""")
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('oice', 'og_image') op.drop_column('oice', 'image') op.drop_column('oice', 'description') op.drop_column('oice', 'og_title') op.drop_column('oice', 'og_description') op.add_column( 'story', sa.Column('og_image', pyramid_safile.FileHandleStore(length=255), nullable=True))
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('user', sa.Column('avatar_storage', pyramid_safile.FileHandleStore(length=255), nullable=False, server_default='{\"filename\": \"\", \"storage\": \"fs\", \"size\": 0, \"path\": \"\"}')) op.add_column('user', sa.Column('description', sa.Unicode(length=1024), nullable=False, server_default="")) op.add_column('user', sa.Column('display_name', sa.Unicode(length=128), nullable=False)) op.add_column('user', sa.Column('language', sa.Unicode(length=5), nullable=False, server_default="zh_HK")) # Set all existing display_name to the email conn = op.get_bind() conn.execute(""" UPDATE user SET display_name = email;""") conn.execute(""" UPDATE user SET avatar_storage = '{"filename": "", "storage": "fs", "size": 0, "path": ""}'""") op.create_unique_constraint("uq_display_name", 'user', ['display_name'])