mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Make postage column part of ft_billing primary key
Now that the postage column is populated and there are no null values, it can be added to the composite primary key of ft_billing.
This commit is contained in:
39
migrations/versions/0235_add_postage_to_pk.py
Normal file
39
migrations/versions/0235_add_postage_to_pk.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0235_add_postage_to_pk
|
||||
Revises: 0234_ft_billing_postage
|
||||
Create Date: 2018-09-28 15:39:21.115358
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = '0235_add_postage_to_pk'
|
||||
down_revision = '0234_ft_billing_postage'
|
||||
|
||||
|
||||
def upgrade():
|
||||
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'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_constraint('ft_billing_pkey', 'ft_billing', type_='primary')
|
||||
op.alter_column('ft_billing', 'postage', nullable=True)
|
||||
op.create_primary_key('ft_billing_pkey', 'ft_billing', ['bst_date',
|
||||
'template_id',
|
||||
'service_id',
|
||||
'notification_type',
|
||||
'provider',
|
||||
'rate_multiplier',
|
||||
'international',
|
||||
'rate'])
|
||||
Reference in New Issue
Block a user