mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Update created_at column of ft_billing to be non-nullable
`created_at` was added previously and made nullable temporarily. This commit now populates the column, ensures that it will always have a value, and makes `created_at` non-nullable.
This commit is contained in:
23
migrations/versions/0194_ft_billing_created_at.py
Normal file
23
migrations/versions/0194_ft_billing_created_at.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0194_ft_billing_created_at
|
||||
Revises: 0193_add_ft_billing_timestamps
|
||||
Create Date: 2018-05-22 14:34:27.852096
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0194_ft_billing_created_at'
|
||||
down_revision = '0193_add_ft_billing_timestamps'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute("UPDATE ft_billing SET created_at = NOW()")
|
||||
op.alter_column('ft_billing', 'created_at', nullable=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('ft_billing', 'created_at', nullable=True)
|
||||
op.execute("UPDATE ft_billing SET created_at = null")
|
||||
Reference in New Issue
Block a user