mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 22:42:28 -05:00
Set Templates.hidden column as non-nullable
Sets hidden to false for all existing templates and makes column non-nullable.
This commit is contained in:
25
migrations/versions/0170_hidden_non_nullable.py
Normal file
25
migrations/versions/0170_hidden_non_nullable.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0170_hidden_non_nullable
|
||||
Revises: 0169_hidden_templates_nullable
|
||||
Create Date: 2018-02-21 14:05:04.448977
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
|
||||
revision = '0170_hidden_non_nullable'
|
||||
down_revision = '0169_hidden_templates_nullable'
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.execute('UPDATE templates SET hidden=false WHERE hidden is NULL')
|
||||
op.execute('UPDATE templates_history SET hidden=false WHERE hidden is NULL')
|
||||
|
||||
op.alter_column('templates', 'hidden', nullable=False)
|
||||
op.alter_column('templates_history', 'hidden', nullable=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.alter_column('templates', 'hidden', nullable=True)
|
||||
op.alter_column('templates_history', 'hidden', nullable=True)
|
||||
Reference in New Issue
Block a user