mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Merge pull request #947 from alphagov/revert-944-update-notification-international
Revert "Update notification international"
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: 0082_set_international
|
|
||||||
Revises: 0081_noti_status_as_enum
|
|
||||||
Create Date: 2017-05-05 15:26:34.621670
|
|
||||||
|
|
||||||
"""
|
|
||||||
from datetime import datetime
|
|
||||||
from alembic import op
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '0082_set_international'
|
|
||||||
down_revision = '0081_noti_status_as_enum'
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
conn = op.get_bind()
|
|
||||||
start = datetime.utcnow()
|
|
||||||
notification_history = "select id from notification_history where international is null limit 10000"
|
|
||||||
|
|
||||||
results = conn.execute(notification_history)
|
|
||||||
res = results.fetchall()
|
|
||||||
|
|
||||||
while len(res) > 0:
|
|
||||||
conn.execute("update notification_history set international = False where id in ({})".format(
|
|
||||||
notification_history))
|
|
||||||
results = conn.execute(notification_history)
|
|
||||||
res = results.fetchall()
|
|
||||||
|
|
||||||
notifications = "select id from notifications where international is null limit 10000"
|
|
||||||
results2 = conn.execute(notifications)
|
|
||||||
res2 = results2.fetchall()
|
|
||||||
while len(res2) > 0:
|
|
||||||
conn.execute("update notifications set international = False where id in ({})".format(notifications))
|
|
||||||
|
|
||||||
results2 = conn.execute(notifications)
|
|
||||||
res2 = results2.fetchall()
|
|
||||||
|
|
||||||
end = datetime.utcnow()
|
|
||||||
print("Started at: {} ended at: {}".format(start, end))
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
# There is no way to downgrade this update.
|
|
||||||
pass
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: 0083_set_international_not_null
|
|
||||||
Revises: 0082_set_international
|
|
||||||
Create Date: 2017-05-10 14:08:51.067762
|
|
||||||
|
|
||||||
"""
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '0083_set_international_not_null'
|
|
||||||
down_revision = '0082_set_international'
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
op.alter_column('notification_history', 'international',
|
|
||||||
existing_type=sa.BOOLEAN(),
|
|
||||||
nullable=False)
|
|
||||||
op.alter_column('notifications', 'international',
|
|
||||||
existing_type=sa.BOOLEAN(),
|
|
||||||
nullable=False)
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
op.alter_column('notifications', 'international',
|
|
||||||
existing_type=sa.BOOLEAN(),
|
|
||||||
nullable=True)
|
|
||||||
op.alter_column('notification_history', 'international',
|
|
||||||
existing_type=sa.BOOLEAN(),
|
|
||||||
nullable=True)
|
|
||||||
Reference in New Issue
Block a user