Running into this error when my db has more than one schema when using the migration generate command. Other commands are ok
For better context, I am using pg-boss for background jobs and it creates its own schema pgboss
Tried specifying which schema to use but no luck
export const change = rakeDb(
{
databaseURL: process.env.DATABASE_URL,
schema: 'public',
},
{
baseTable: BaseTable,
snakeCase: true,
migrationId: 'serial',
migrationsPath: './migrations',
migrationsTable: 'schema_migrations',
dbPath: './db',
import: (path) => import(path),
log: true,
async beforeChange({ db }) {
//confirm we are dealing with public schema
console.log((await db.query`SHOW search_path`).rows[0]);
},
},
);
The error I get:
C:\development\node\project\node_modules\rake-db\src\generate\astToMigration.ts:121
new Error(
^
Error: Cannot satisfy migration dependencies: [
{
"ast": {
"type": "schema",
"action": "drop",
"name": "pgboss"
},
"add": [],
"drop": [
"pgboss"
],
"deps": []
}
]
There is a generatorIgnore option to ignore tables, but not schemas yet, I'll add so you can list schemas and other db structures for the migrations generator to ignore.
Not sure why this error is happening, will fix.
I added generatorIgnore config for this case, add the following to orchidORM:
export const db = orchidORM(
{
// ...other options
generatorIgnore: {
// pgboss library keeps all its db objects in the `pgboss` schema.
schemas: ['pgboss'],
}
//...
)
And the generator will ignore everything in the pgboss schema.
Fixed one bug in the generator along the way, thank you for helping discovering it.
Works like a charm. Thank you.