auth icon indicating copy to clipboard operation
auth copied to clipboard

feat: update `migrate` to be transactional

Open hf opened this issue 2 years ago • 0 comments

The migrate command runs migrations one at a time, stopping until the last one that could be fully and successfully completed.

However, GoTrue is exclusively built with PostgreSQL in mind, which supports transactional DDL statements. As we've seen operating many thousands of GoTrue instances in the wild, it's much more useful for migrations between release A and A' to run fully or none at all. Thus the migrate command is refactored to run the migrations within a transaction block.

If the migrations are not able to run all at once, the command will exit with 123 which can be used as a special signal to operators that the transition from release A to A' is not compatible; and release A can continue to safely run.

hf avatar Jun 06 '23 15:06 hf