more work on postage migration

This commit is contained in:
stvnrlly
2023-02-12 21:55:24 -05:00
parent 4a0e555696
commit 36e730221d
12 changed files with 25 additions and 50 deletions

View File

@@ -15,6 +15,16 @@ down_revision = '0384_remove_letter_branding_'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint('ft_billing_pkey', 'ft_billing', type_='primary')
op.create_primary_key('ft_billing_pkey', 'ft_billing', ['local_date',
'template_id',
'service_id',
'notification_type',
'provider',
'rate_multiplier',
'international',
'rate'])
# we need to replace the entire notifications_all_time_view in order to update it
op.execute("DROP VIEW notifications_all_time_view;")
op.execute("""
@@ -78,15 +88,6 @@ def upgrade():
op.drop_column('templates', 'postage')
op.drop_column('templates_history', 'postage')
op.drop_column('ft_billing', 'postage')
# op.drop_constraint('ft_billing_pkey', 'ft_billing', type_='primary')
# op.create_primary_key('ft_billing_pkey', 'ft_billing', ['bst_date',
# 'template_id',
# 'service_id',
# 'notification_type',
# 'provider',
# 'rate_multiplier',
# 'international',
# 'rate'])
# ### end Alembic commands ###
@@ -98,16 +99,16 @@ def downgrade():
op.add_column('notifications', sa.Column('postage', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('notification_history', sa.Column('postage', sa.VARCHAR(), autoincrement=False, nullable=True))
# op.drop_constraint('ft_billing_pkey', 'ft_billing', type_='primary')
# op.create_primary_key('ft_billing_pkey', 'ft_billing', ['bst_date',
# 'template_id',
# 'service_id',
# 'notification_type',
# 'provider',
# 'rate_multiplier',
# 'international',
# 'rate',
# 'postage'])
op.drop_constraint('ft_billing_pkey', 'ft_billing', type_='primary')
op.create_primary_key('ft_billing_pkey', 'ft_billing', ['local_date',
'template_id',
'service_id',
'notification_type',
'provider',
'rate_multiplier',
'international',
'rate',
'postage'])
op.execute("DROP VIEW notifications_all_time_view;")
op.execute("""