weavejester / ragtime

Database-independent migration library
Eclipse Public License 1.0
611 stars 85 forks source link

Migrations table with postgres schema #80

Open donbonifacio opened 9 years ago

donbonifacio commented 9 years ago

Hello,

I tried to change the migrations table to one using a postgres schema:

{:datastore  (jdbc/sql-database (System/getenv "CONN")
                   {:migrations-table "directory.ragtime_migrations"})
 :migrations (jdbc/load-directory "migrations")})

And I get:

Exception in thread "main" org.postgresql.util.PSQLException: ERROR: relation "directory.ragtime_migrations" does not exist

If I change, for example to directory_ragtime_migrations, everything works as expected.

metametadata commented 7 years ago

Has there been any solution found? I guess I've just stumbled upon the similar issue using Joplin. But the error message (for :migrations-table "myschema.migrations") looks like this:

PSQLException ERROR: relation "migrations" already exists  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse (QueryExecutorImpl.java:2455)
weavejester commented 7 years ago

PRs to fix this are welcome. I haven't had the chance to investigate this myself.

campeterson commented 7 years ago

I'm also seeing the issue. Appears to happen (at least for me) when specifying a schema (other than defaulting to 'public').

mrcnc commented 7 years ago

I had a similar issue that was caused b/c ragtime was trying to create the table in a schema that did not yet exist. I fixed it by first creating the schema I wanted the migrations table to be in, then ragtime was able to create the migrations table in my schema.