mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
Make Noti and NotiHis status column nullable:
This is in preparation for deprecating this old column
This commit is contained in:
@@ -788,7 +788,7 @@ class Notification(db.Model):
|
|||||||
unique=False,
|
unique=False,
|
||||||
nullable=True,
|
nullable=True,
|
||||||
onupdate=datetime.datetime.utcnow)
|
onupdate=datetime.datetime.utcnow)
|
||||||
_status_enum = db.Column('status', NOTIFICATION_STATUS_TYPES_ENUM, index=True, nullable=False, default='created')
|
_status_enum = db.Column('status', NOTIFICATION_STATUS_TYPES_ENUM, index=True, nullable=True, default='created')
|
||||||
_status_fkey = db.Column(
|
_status_fkey = db.Column(
|
||||||
'notification_status',
|
'notification_status',
|
||||||
db.String,
|
db.String,
|
||||||
@@ -999,7 +999,7 @@ class NotificationHistory(db.Model, HistoryModel):
|
|||||||
sent_at = db.Column(db.DateTime, index=False, unique=False, nullable=True)
|
sent_at = db.Column(db.DateTime, index=False, unique=False, nullable=True)
|
||||||
sent_by = db.Column(db.String, nullable=True)
|
sent_by = db.Column(db.String, nullable=True)
|
||||||
updated_at = db.Column(db.DateTime, index=False, unique=False, nullable=True)
|
updated_at = db.Column(db.DateTime, index=False, unique=False, nullable=True)
|
||||||
_status_enum = db.Column('status', NOTIFICATION_STATUS_TYPES_ENUM, index=True, nullable=False, default='created')
|
_status_enum = db.Column('status', NOTIFICATION_STATUS_TYPES_ENUM, index=True, nullable=True, default='created')
|
||||||
_status_fkey = db.Column(
|
_status_fkey = db.Column(
|
||||||
'notification_status',
|
'notification_status',
|
||||||
db.String,
|
db.String,
|
||||||
|
|||||||
55
migrations/versions/0106_null_noti_status.py
Normal file
55
migrations/versions/0106_null_noti_status.py
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
Revision ID: 0106_null_noti_status
|
||||||
|
Revises: 0105_opg_letter_org
|
||||||
|
Create Date: 2017-07-10 11:18:27.267721
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
revision = '0106_null_noti_status'
|
||||||
|
down_revision = '0105_opg_letter_org'
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.alter_column(
|
||||||
|
'notification_history',
|
||||||
|
'status',
|
||||||
|
existing_type=postgresql.ENUM(
|
||||||
|
'created', 'sending', 'delivered', 'pending', 'failed', 'technical-failure',
|
||||||
|
'temporary-failure', 'permanent-failure', 'sent', name='notify_status_type'
|
||||||
|
),
|
||||||
|
nullable=True
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
'notifications',
|
||||||
|
'status',
|
||||||
|
existing_type=postgresql.ENUM(
|
||||||
|
'created', 'sending', 'delivered', 'pending', 'failed', 'technical-failure',
|
||||||
|
'temporary-failure', 'permanent-failure', 'sent', name='notify_status_type'
|
||||||
|
),
|
||||||
|
nullable=True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.alter_column(
|
||||||
|
'notifications',
|
||||||
|
'status',
|
||||||
|
existing_type=postgresql.ENUM(
|
||||||
|
'created', 'sending', 'delivered', 'pending', 'failed', 'technical-failure',
|
||||||
|
'temporary-failure', 'permanent-failure', 'sent', name='notify_status_type'
|
||||||
|
),
|
||||||
|
nullable=False
|
||||||
|
)
|
||||||
|
op.alter_column(
|
||||||
|
'notification_history',
|
||||||
|
'status',
|
||||||
|
existing_type=postgresql.ENUM(
|
||||||
|
'created', 'sending', 'delivered', 'pending', 'failed', 'technical-failure',
|
||||||
|
'temporary-failure', 'permanent-failure', 'sent', name='notify_status_type'
|
||||||
|
),
|
||||||
|
nullable=False
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user