Postgres-js Migrate - Error: Can't find meta/_journal.json file [SOLVED]

I've gotten drizzle setup and running but I'm unable to run any migrations. I'm using postgres-js and created a migrate.ts file that i'm executing. Here is my code: /lib/migrate.ts
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';

const migrationClient = postgres("...", { max: 1 });
migrate(drizzle(migrationClient), { migrationsFolder: '../migrations-folder' });
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';

const migrationClient = postgres("...", { max: 1 });
migrate(drizzle(migrationClient), { migrationsFolder: '../migrations-folder' });
I setup my config file: ./crizzle.config.json
{
"out": "./migrations-folder",
"schema": "./lib/drizzle.ts",
"breakpoints": false
}
{
"out": "./migrations-folder",
"schema": "./lib/drizzle.ts",
"breakpoints": false
}
so I've managed to generate some migrations in the migrations-folder but the migrate function is failing. I've tried different databases, locations, tried to trigger the migration through a trpc api call.
9 Replies
Andrii Sherman
Could you please show migration folder content?
jannis
jannis3y ago
I'm having the same issue
jannis
jannis3y ago
Andrii Sherman
are you sure, that migrationsFolder path in migrate function is right?
jannis
jannis3y ago
I think I've found out what the issue is, even though the index.ts file is several directories deep, you still have to give the file path as if it was in the root directory if that makes sense
Gambit
GambitOP3y ago
That's the folder. I'll try what Jannis said now.
Gambit
GambitOP3y ago
Its running now, so jannis was right. But it just gets stuck
Gambit
GambitOP3y ago
Gambit
GambitOP3y ago
It wasn't stuck, the connect just stayed open. I added a close on the .then

Did you find this page helpful?