NYPL-Simplified / server_core

Shared data model and utilities for Library Simplified server applications
7 stars 11 forks source link

Simplify UTC timestamp migration, run as single statement transactions #1259

Closed nballenger closed 3 years ago

nballenger commented 3 years ago

I've changed two things:

  1. I set the migration/20210405-update-datetime-columns.sql file up to use one ALTER per table, and removed the UPDATE statements because the conversion is actually accomplished during the table alteration.
  2. I added some logic to scripts.py in the DatabaseMigrationScript class, aimed at running individual statements in a migration file within their own transactions. That only triggers if somewhere in the .sql file the string SIMPLYE_MIGRATION_TRANSACTION_PER_STATEMENT appears.

I don't have the circ manager set up locally in a way that makes this easy to test, so anything you spot would be good to know about before I build this and try it on QA.

nballenger commented 3 years ago

Thanks--I think as long as it runs successfully that's fine, we'll just have to see how it fares at scale on the QA db.