コード例 #1
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'sysdiagrams',
        sa.Column('name',
                  sa.NVARCHAR(length=128),
                  autoincrement=False,
                  nullable=False),
        sa.Column('principal_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('diagram_id',
                  sa.INTEGER(),
                  autoincrement=True,
                  nullable=False,
                  mssql_identity_start=1,
                  mssql_identity_increment=1),
        sa.Column('version', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('definition',
                  mssql.VARBINARY(),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('diagram_id',
                                name='PK__sysdiagr__C2B05B61D6E28DD1'))
コード例 #2
0
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'Student',
        sa.Column('sname',
                  sa.NCHAR(length=10),
                  autoincrement=False,
                  nullable=False),
        sa.Column('sex',
                  sa.NCHAR(length=2),
                  autoincrement=False,
                  nullable=False),
        sa.Column('bir', sa.DATETIME(), autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('sname',
                                name=u'PK__Student__0F1ED58278C86C61'))
    op.create_table(
        'sysdiagrams',
        sa.Column('name',
                  sa.NVARCHAR(length=128),
                  autoincrement=False,
                  nullable=False),
        sa.Column('principal_id',
                  sa.INTEGER(),
                  autoincrement=False,
                  nullable=False),
        sa.Column('diagram_id', sa.INTEGER(), nullable=False),
        sa.Column('version', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('definition',
                  mssql.VARBINARY(length='max'),
                  autoincrement=False,
                  nullable=True),
        sa.PrimaryKeyConstraint('diagram_id',
                                name=u'PK__sysdiagr__C2B05B618078E22A'))
    op.create_table(
        'Table1',
        sa.Column('id', sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column('name',
                  sa.NCHAR(length=10),
                  autoincrement=False,
                  nullable=True))
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_table('users')
    op.drop_table('roles')
コード例 #3
0
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user',
    sa.Column('id_user', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=20), nullable=False),
    sa.Column('surname', sa.String(length=20), nullable=False),
    sa.Column('name', sa.String(length=20), nullable=False),
    sa.Column('patronymic', sa.String(length=20), nullable=False),
    sa.Column('position', sa.String(length=20), nullable=False),
    sa.PrimaryKeyConstraint('id_user')
    )
    op.create_table('freq',
    sa.Column('id_result', sa.Integer(), nullable=False),
    sa.Column('freqword', sa.Integer(), nullable=False),
    sa.Column('count', sa.Integer(), nullable=False),
    sa.Column('word', sa.String(length=20), nullable=False),
    sa.Column('id_text', sa.Integer(), nullable=False),
    sa.Column('time', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['id_text'], ['text.id_text'], ),
    sa.PrimaryKeyConstraint('id_result')
    )
    op.drop_table('users_text')
    op.drop_table('separatewords')
    op.drop_table('freqanalysis')
    op.drop_table('sysdiagrams')
    op.drop_table('descriptword')
    op.drop_table('users')
    op.add_column('semantic', sa.Column('text_id', sa.Integer(), nullable=False))
    op.drop_constraint('FK_semantic_text', 'semantic', type_='foreignkey')
    op.create_foreign_key(None, 'semantic', 'text', ['text_id'], ['id_text'])
    op.drop_column('semantic', 'id_text')
    op.add_column('syntax', sa.Column('text_id', sa.Integer(), nullable=False))
    op.drop_constraint('FK_syntax_text', 'syntax', type_='foreignkey')
    op.create_foreign_key(None, 'syntax', 'text', ['text_id'], ['id_text'])
    op.drop_column('syntax', 'id_text')
    op.alter_column('text', 'file',
               existing_type=mssql.VARBINARY(),
               nullable=False)
コード例 #4
0
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('text', 'file',
               existing_type=mssql.VARBINARY(),
               nullable=True)
    op.add_column('syntax', sa.Column('id_text', sa.INTEGER(), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'syntax', type_='foreignkey')
    op.create_foreign_key('FK_syntax_text', 'syntax', 'text', ['id_text'], ['id_text'])
    op.drop_column('syntax', 'text_id')
    op.add_column('semantic', sa.Column('id_text', sa.INTEGER(), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'semantic', type_='foreignkey')
    op.create_foreign_key('FK_semantic_text', 'semantic', 'text', ['id_text'], ['id_text'])
    op.drop_column('semantic', 'text_id')
    op.create_table('users',
    sa.Column('id_user', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('email', sa.NVARCHAR(length=20), autoincrement=False, nullable=False),
    sa.Column('surname', sa.NVARCHAR(length=20), autoincrement=False, nullable=False),
    sa.Column('name', sa.NVARCHAR(length=20), autoincrement=False, nullable=False),
    sa.Column('patronymic', sa.NVARCHAR(length=20), autoincrement=False, nullable=False),
    sa.Column('position', sa.NVARCHAR(length=20), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id_user', name='PK_users')
    )
    op.create_table('descriptword',
    sa.Column('id_word', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('word', sa.NVARCHAR(length=50), autoincrement=False, nullable=False),
    sa.Column('id_text', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['id_text'], ['text.id_text'], name='FK_descriptword_text'),
    sa.PrimaryKeyConstraint('id_word', name='PK_descriptword')
    )
    op.create_table('sysdiagrams',
    sa.Column('name', sa.NVARCHAR(length=128), autoincrement=False, nullable=False),
    sa.Column('principal_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('diagram_id', sa.INTEGER(), nullable=False),
    sa.Column('version', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('definition', mssql.VARBINARY(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('diagram_id', name='PK__sysdiagr__C2B05B6162352B50')
    )
    op.create_table('freqanalysis',
    sa.Column('id_result', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('freqword', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('count', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('word', sa.VARCHAR(length=50, collation='Cyrillic_General_CI_AS'), autoincrement=False, nullable=False),
    sa.Column('id_text', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('time', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['id_text'], ['text.id_text'], name='FK_freqanalysis_text'),
    sa.PrimaryKeyConstraint('id_result', name='PK_freqanalysis')
    )
    op.create_table('separatewords',
    sa.Column('id_result', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('word', sa.VARCHAR(length=50, collation='Cyrillic_General_CI_AS'), autoincrement=False, nullable=False),
    sa.Column('id_text', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['id_text'], ['text.id_text'], name='FK_separatewords_text'),
    sa.PrimaryKeyConstraint('id_result', name='PK_separatewords')
    )
    op.create_table('users_text',
    sa.Column('id_text', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('id_user', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['id_text'], ['text.id_text'], name='FK_users_text_text'),
    sa.ForeignKeyConstraint(['id_user'], ['users.id_user'], name='FK_users_text_users')
    )
    op.drop_table('freq')
    op.drop_table('user')