I'm trying to add dropwizard-migrations to an existing project. It is already using dropwizard-hibernate for the database. I attempted a "db dump" as suggested by the documentation, and got a "permission denied" error.
The PostgreSQL database it's connecting to has several schemas, the DB user it's connecting as only has access to the schema for this application. The SQL request it's making would return a bunch of information about sequences from all schemas, so PostgreSQL isn't allowing it.
INFO ColumnAutoIncrementService - Could not read identity information
liquibase.exception.DatabaseException: Error executing SQL SELECT ns.nspname as SCHEMA_NAME, td.relname as TABLE_NAME, pa.attname as COLUMN_NAME, COALESCE(pg_sequence_last_value(c.oid::regclass) + s.seqincrement, s.seqstart) AS START_VALUE, s.seqincrement AS INCREMENT_BY FROM pg_class c JOIN pg_sequence s on c.oid = s.seqrelid JOIN pg_namespace ns on c.relnamespace = ns.oid JOIN pg_depend d ON c.oid = d.objid JOIN pg_class td ON td.oid = d.refobjid JOIN pg_attribute pa ON pa.attrelid=td.oid AND pa.attnum=d.refobjsubid WHERE c.relkind = 'S' AND d.deptype = 'a': ERROR: permission denied for sequence ######
Note that if the same user made the same SQL request but added AND ns.nspname = 'my_schema' to the WHERE clause, it would be allowed. I've tried several ways to explain to it what schema it should be using, but haven't been able to convince it to limit this request like that.
Things I have tried:
--schema my_schemaon the command line- Setting the db user's search_path to my_schema in the database
- Various methods of setting the schema in config.yml that don't seem to have worked (all were things I found from old posts online; nothing consistent with the current docs)
Is there some correct way to tell it to only look for sequences in the schema is has permission for?
It's also possible that I'm misunderstanding something very fundamental here. I haven't used Liquibase or other db migration tools before. The fact that I couldn't find anyone with a similar problem makes me think that either I'm doing something way off base, or maybe dropwizard-migrations just isn't super popular?