Skip to content

Commit

Permalink
Add migrationsFolder to opts
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Jan 19, 2024
1 parent 6bb4b45 commit 1c5096e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default class Pool<TSchema extends Record<string, unknown> = Record<strin
*/
static async connect<TSchema extends Record<string, unknown> = Record<string, never>>(connstr: string, schema: TSchema, opts: {
retry?: number;
migrationsFolder?: string;
jsonschema?: {
dir: string | URL;
};
Expand Down Expand Up @@ -102,7 +103,9 @@ export default class Pool<TSchema extends Record<string, unknown> = Record<strin
dir: opts.jsonschema.dir
});

await migrate(pool, { migrationsFolder: 'migrations' });
if (opts.migrationsFolder) {
await migrate(pool, { migrationsFolder: opts.migrationsFolder });
}

return pool;
}
Expand Down

0 comments on commit 1c5096e

Please sign in to comment.