migration: add missing delete from down migration
This also reorganizes the file a bit.
This commit is contained in:
parent
4a521f5844
commit
e47b29a974
1 changed files with 15 additions and 4 deletions
|
@ -25,12 +25,16 @@ def upgrade(tables):
|
||||||
sa.Column('notes', UTF8LongText(), nullable=False),
|
sa.Column('notes', UTF8LongText(), nullable=False),
|
||||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_servicekeyapproval')),
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_servicekeyapproval')),
|
||||||
)
|
)
|
||||||
|
op.create_index('servicekeyapproval_approval_type', 'servicekeyapproval', ['approval_type'], unique=False)
|
||||||
|
op.create_index('servicekeyapproval_approver_id', 'servicekeyapproval', ['approver_id'], unique=False)
|
||||||
|
|
||||||
|
|
||||||
op.bulk_insert(
|
op.bulk_insert(
|
||||||
tables.notificationkind,
|
tables.notificationkind,
|
||||||
[{'name':'service_key_submitted'}],
|
[{'name':'service_key_submitted'}],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
op.bulk_insert(tables.logentrykind, [
|
op.bulk_insert(tables.logentrykind, [
|
||||||
{'name':'service_key_create'},
|
{'name':'service_key_create'},
|
||||||
{'name':'service_key_approve'},
|
{'name':'service_key_approve'},
|
||||||
|
@ -40,8 +44,7 @@ def upgrade(tables):
|
||||||
{'name':'service_key_rotate'},
|
{'name':'service_key_rotate'},
|
||||||
])
|
])
|
||||||
|
|
||||||
op.create_index('servicekeyapproval_approval_type', 'servicekeyapproval', ['approval_type'], unique=False)
|
|
||||||
op.create_index('servicekeyapproval_approver_id', 'servicekeyapproval', ['approver_id'], unique=False)
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'servicekey',
|
'servicekey',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
@ -58,15 +61,15 @@ def upgrade(tables):
|
||||||
name=op.f('fk_servicekey_approval_id_servicekeyapproval')),
|
name=op.f('fk_servicekey_approval_id_servicekeyapproval')),
|
||||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_servicekey')),
|
sa.PrimaryKeyConstraint('id', name=op.f('pk_servicekey')),
|
||||||
)
|
)
|
||||||
|
|
||||||
op.create_index('servicekey_approval_id', 'servicekey', ['approval_id'], unique=False)
|
op.create_index('servicekey_approval_id', 'servicekey', ['approval_id'], unique=False)
|
||||||
op.create_index('servicekey_kid', 'servicekey', ['kid'], unique=True)
|
op.create_index('servicekey_kid', 'servicekey', ['kid'], unique=True)
|
||||||
op.create_index('servicekey_service', 'servicekey', ['service'], unique=False)
|
op.create_index('servicekey_service', 'servicekey', ['service'], unique=False)
|
||||||
|
|
||||||
|
|
||||||
op.add_column(u'notification', sa.Column('lookup_path', sa.String(length=255), nullable=True))
|
op.add_column(u'notification', sa.Column('lookup_path', sa.String(length=255), nullable=True))
|
||||||
op.create_index('notification_lookup_path', 'notification', ['lookup_path'], unique=False)
|
op.create_index('notification_lookup_path', 'notification', ['lookup_path'], unique=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade(tables):
|
def downgrade(tables):
|
||||||
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_create')))
|
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_create')))
|
||||||
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_approve')))
|
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_approve')))
|
||||||
|
@ -75,6 +78,14 @@ def downgrade(tables):
|
||||||
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_extend')))
|
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_extend')))
|
||||||
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_rotate')))
|
op.execute(tables.logentrykind.delete().where(tables.logentrykind.c.name == op.inline_literal('service_key_rotate')))
|
||||||
|
|
||||||
|
|
||||||
|
op.execute(tables.notificationkind.delete().where(tables.notificationkind.c.name == op.inline_literal('service_key_submitted')))
|
||||||
|
|
||||||
|
|
||||||
op.drop_column(u'notification', 'lookup_path')
|
op.drop_column(u'notification', 'lookup_path')
|
||||||
|
|
||||||
|
|
||||||
op.drop_table('servicekey')
|
op.drop_table('servicekey')
|
||||||
|
|
||||||
|
|
||||||
op.drop_table('servicekeyapproval')
|
op.drop_table('servicekeyapproval')
|
||||||
|
|
Reference in a new issue