top | item 36169213

(no title)

kevinmgranger | 2 years ago

Not strictly relevant, but:

I've yet to see tools that handle zero-downtime-migrations well. The manual task of keeping two versions of the same query / model alive (version N and version N+1) is... well, how else would you handle it?

While tools that can generate the model or schema are nice, they never seem to account for this.

Is there some alternative approach I'm missing?

discuss

order

efxhoy|2 years ago

Have your query as a function in the database. BEGIN, do the migration, replace the function, COMMIT. Postgres DDL is transactional so at no point does the function stop working.