Ensure the downgrade script targets only DMP services

This commit is contained in:
Martyn Inglis
2016-08-01 12:20:06 +01:00
parent 183fc7d639
commit cfb29d4404

View File

@@ -20,7 +20,6 @@ from app.models import Job, Template, NotificationHistory
def upgrade():
session = Session(bind=op.get_bind())
go_live = datetime.datetime.strptime('2016-05-18', '%Y-%m-%d')
@@ -70,9 +69,10 @@ def downgrade():
go_live = datetime.datetime.strptime('2016-05-18', '%Y-%m-%d')
notifications_history_start_date = datetime.datetime.strptime('2016-06-26 23:21:55', '%Y-%m-%d %H:%M:%S')
session.query(NotificationHistory).filter(NotificationHistory.created_at >= go_live,
NotificationHistory.created_at <
notifications_history_start_date).delete()
session.query(NotificationHistory).filter(
NotificationHistory.created_at >= go_live,
NotificationHistory.service_id == '95316ff0-e555-462d-a6e7-95d26fbfd091',
NotificationHistory.created_at < notifications_history_start_date).delete()
session.commit()
### end Alembic commands ###