def downgrade():
'''
downgrade method
'''
if context.get_context().dialect.name == 'postgresql':
drop_constraint('ACCOUNT_LIMITS_PK', 'account_limits', type_='primary')
drop_constraint('ACCOUNT_LIMITS_CREATED_NN', 'account_limits')
drop_constraint('ACCOUNT_LIMITS_UPDATED_NN', 'account_limits')
drop_constraint('ACCOUNT_LIMITS_ACCOUNT_FK', 'account_limits')
drop_constraint('ACCOUNT_LIMITS_RSE_ID_FK', 'account_limits')
drop_table('account_limits')
create_table('account_limits',
sa.Column('account', sa.String(25)),
sa.Column('rse_expression', sa.String(255)),
sa.Column('name', sa.String(255)),
sa.Column('value', sa.BigInteger),
sa.Column('updated_at', sa.DateTime),
sa.Column('created_at', sa.DateTime))
if context.get_context().dialect.name != 'sqlite':
create_primary_key('ACCOUNT_LIMITS_PK', 'account_limits', ['account', 'rse_expression', 'name'])
create_check_constraint('ACCOUNT_LIMITS_CREATED_NN', 'account_limits', 'created_at is not null')
create_check_constraint('ACCOUNT_LIMITS_UPDATED_NN', 'account_limits', 'updated_at is not null')
create_foreign_key('ACCOUNT_LIMITS_ACCOUNT_FK', 'account_limits', 'accounts', ['account'], ['account'])
d91002c5841_new_account_limits_table.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录