ebean-orm / ebean-migration

DB Migration runner (similar to Flyway) which can be used standalone or with Ebean (run migrations on EbeanServer start)
Apache License 2.0
9 stars 5 forks source link

MigrationTable.tableExists ignores schema #3

Closed ksperling closed 7 years ago

ksperling commented 8 years ago

It seems MigrationTable.schema is always null, so at least on PG it looks for the db_migration table in any schema rather than the current one (which I'm setting via the jdbc url). If the current schema doesn't have the table but another one does it then blows up when trying to use it (as it's in the wrong schema).

It seems that absent any particular schema being configured, it should use connection.getSchema() to find the schema name.

Or maybe the simplest approach would be to just try to blindly load the migrations and handle the 'table not found' error by creating it.

rbygrave commented 7 years ago

Ok, the commit above just reads the schema from config and uses that (rather than it always being null). To me that ought to fix this issue (assuming the the config has the correct schema set).

I'll close this for now. Please re-open if this doesn't work for your use case and I'll review it again.

Thanks, Rob.