Open stathismor opened 11 months ago
Migrations on custom schemas do not seem to be taking effect when using the pg adapter.
pg
A simplified version of my code: import { newDb } from 'pg-mem'; const SCHEMA = 'test'; const db = newDb(); db.createSchema(SCHEMA); const migrationsPath = 'migrations'; await db.getSchema(SCHEMA).migrate({ migrationsPath, }); const { Client } = db.adapters.createPg(); const client = new Client(); const query = client.query.bind(client); console.log(await query('SELECT * FROM information_schema.tables;'));
migrationsPath has just an SQL file with a single query:
migrationsPath
CREATE TABLE test_user ( id uuid NOT NULL );
This print the following. As you see, table_schema is still public where, when I used my own schema (test):
table_schema
public
test
{ rows: [ { table_catalog: 'pgmem', table_schema: 'public', table_name: 'migrations', table_type: 'BASE TABLE', self_referencing_column_name: null, reference_generation: null, user_defined_type_catalog: null, user_defined_type_schema: null, user_defined_type_name: null, is_insertable_into: 'YES', is_typed: 'NO', commit_action: null }, { table_catalog: 'pgmem', table_schema: 'public', table_name: 'test_user', table_type: 'BASE TABLE', self_referencing_column_name: null, reference_generation: null, user_defined_type_catalog: null, user_defined_type_schema: null, user_defined_type_name: null, is_insertable_into: 'YES', is_typed: 'NO', commit_action: null } ], rowCount: 2, command: 'SELECT', fields: [Getter], location: { start: 0, end: 0 } }
2.7.1
Describe the bug
Migrations on custom schemas do not seem to be taking effect when using the
pg
adapter.To Reproduce
migrationsPath
has just an SQL file with a single query:This print the following. As you see,
table_schema
is stillpublic
where, when I used my own schema (test
):pg-mem version
2.7.1