3 ms·
The column change phase 2 has a sneaky bug in it. In the order presented: 1) Run migration 2) Apply trigger There will be a point in time where the migratio
by jpollock 12y ago
The column change phase 2 has a sneaky bug in it.
In the order presented:
1) Run migration
2) Apply trigger
There will be a point in time where the migration has been done and the trigger hasn't been applied.
Even sneakier, if the trigger is applied in code and not in the database, there will be period in time where some of the code is running the trigger and some isn't.
The trigger needs to be in production and executing prior to the backfill running.
I'm also loathe to rely on "triggers" in application model logic. I've seen too many platforms where the operations engineers interact directly with the database, resulting in required logic not executing.
- jeffdavis 12y agoGreat point. When tricky concurrency is involved, using the built-in tools offered by the database is the safest approach. Often, it's also the easiest and most performant.