From 261ea6fe8f6fc17eec227b557c90264cbffeba72 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 21 Oct 2024 10:32:28 -0700 Subject: [PATCH] fix commented out code --- migrations/versions/0044_jobs_to_notification_hist.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/migrations/versions/0044_jobs_to_notification_hist.py b/migrations/versions/0044_jobs_to_notification_hist.py index e813833b4..3312d9a49 100644 --- a/migrations/versions/0044_jobs_to_notification_hist.py +++ b/migrations/versions/0044_jobs_to_notification_hist.py @@ -31,10 +31,10 @@ def upgrade(): # # 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') - # jobs = session.query(Job).join(Template).filter(Job.service_id == '95316ff0-e555-462d-a6e7-95d26fbfd091', + # stmt = select(Job).join(Template).filter(Job.service_id == '95316ff0-e555-462d-a6e7-95d26fbfd091', # Job.created_at >= go_live, # Job.created_at < notifications_history_start_date).all() - # + # jobs = db.session.execute(stmt).scalars().all() # for job in jobs: # for i in range(0, job.notifications_delivered): # notification = NotificationHistory(id=uuid.uuid4(), @@ -76,12 +76,11 @@ 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( + # stmt = delete(NotificationHistory).where( # NotificationHistory.created_at >= go_live, # NotificationHistory.service_id == '95316ff0-e555-462d-a6e7-95d26fbfd091', - # NotificationHistory.created_at < notifications_history_start_date).delete() - # + # NotificationHistory.created_at < notifications_history_start_date) + # session.execute(stmt) # session.commit() # ### end Alembic commands ### pass