mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 15:22:24 -05:00
Add postage column to ft_billing
Added a new varchar column, postage, to ft_billing. This is nullable and not part of the composite primary key for now, but this will change later.
This commit is contained in:
@@ -1811,6 +1811,7 @@ class FactBilling(db.Model):
|
||||
rate_multiplier = db.Column(db.Integer(), nullable=False, primary_key=True)
|
||||
international = db.Column(db.Boolean, nullable=False, primary_key=True)
|
||||
rate = db.Column(db.Numeric(), nullable=False, primary_key=True)
|
||||
postage = db.Column(db.String)
|
||||
billable_units = db.Column(db.Integer(), nullable=True)
|
||||
notifications_sent = db.Column(db.Integer(), nullable=True)
|
||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||
|
||||
22
migrations/versions/0234_ft_billing_postage.py
Normal file
22
migrations/versions/0234_ft_billing_postage.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0234_ft_billing_postage
|
||||
Revises: 0233_updated_first_class_dates
|
||||
Create Date: 2018-09-28 14:43:26.100884
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = '0234_ft_billing_postage'
|
||||
down_revision = '0233_updated_first_class_dates'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('ft_billing', sa.Column('postage', sa.String(), nullable=True))
|
||||
op.execute("UPDATE ft_billing SET postage = (CASE WHEN notification_type = 'letter' THEN 'second' ELSE 'none' END)")
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('ft_billing', 'postage')
|
||||
Reference in New Issue
Block a user