dbmigrations icon indicating copy to clipboard operation
dbmigrations copied to clipboard

PostgreSQL: If a migration changes schema, migration fails to insert into installed_migrations

Open ocharles opened this issue 9 years ago • 2 comments

We have all our tables in a custom schema. I created the initial migration with pg_dump and then performing a little cleanup. In this script, it begins with:

  CREATE SCHEMA uniplex;
  SET search_path = uniplex, pg_catalog;

However, moo upgrade begins by creating installed_migrations in the public schema. This means that moo upgrade results in a crash, as the inserts aren't qualified with a schema (and the final INSERT INTO installed_migrations thus tries to INSERT into uniplex.installed_migrations)

ocharles avatar Apr 04 '16 09:04 ocharles

Thanks for the report! If I understand this correctly, the fix is just to qualify all operations on the installed_migrations table with the public schema. Right?

I would also be open to making the schema for installed_migrations configurable if that would be desirable (and default to public if unspecified).

I can get to this in the next few days, but please feel free to submit a patch if you can do it sooner!

jtdaugherty avatar Apr 04 '16 17:04 jtdaugherty

Yep, just prefixing should be sufficient.

ocharles avatar Dec 15 '16 11:12 ocharles

Since this package is no longer maintained, I'd like to mark the GitHub repository as read-only. I'm closing this ticket as part of that change. This package is now marked as deprecated on Hackage; see the maintenance note in the README if you're interested in taking over maintenance.

jtdaugherty avatar Jan 30 '24 17:01 jtdaugherty