Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how does flyway lock a postgres schema?

Tags:

flyway

I am using Flyway with Postgres and I have noticed that if I have my tomcat server running, and I try to execute a DROP SCHEMA foo it does not work until tomcat shuts down. I am assuming that flyway has some mechanism to block modifications to the schema after it runs. How is the blocking of other clients modifying the schema accomplished in flyway.

like image 608
ams Avatar asked Sep 08 '25 11:09

ams


1 Answers

Flyway doesn't lock the schema.

When it starts applying a migration, it begins a transaction. It then acquires a lock on the metadata table using SELECT * FROM metadatatable FOR UPDATE. This lock is released automatically after the migration completes when the transaction is commited or rolled back.

like image 98
Axel Fontaine Avatar answered Sep 10 '25 07:09

Axel Fontaine