thomasmol
thomasmol
Explore posts from servers
DTDrizzle Team
Created by thomasmol on 10/20/2023 in #help
Issue running migrate(): error: script "migrate" exited with code 1 (SIGHUP)
I am trying to run my migration script that should execute my migration sql files:
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';

async function main() {
const sql = postgres(process.env.PRIVATE_DATABASE_URL ?? '', { max: 1 });
const db = drizzle(sql);
await migrate(db, { migrationsFolder: './drizzle' });
}

main()
.catch((err) => {
console.error(err);
process.exit(1);
})
.then(() => {
process.exit(0);
});
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';

async function main() {
const sql = postgres(process.env.PRIVATE_DATABASE_URL ?? '', { max: 1 });
const db = drizzle(sql);
await migrate(db, { migrationsFolder: './drizzle' });
}

main()
.catch((err) => {
console.error(err);
process.exit(1);
})
.then(() => {
process.exit(0);
});
But I get this error:
$ bun src/lib/server/database/migrate.ts
ResolveMessage {
stack: "undefined",
query: undefined,
parameters: undefined,
args: [],
types: null,
code: undefined,
importKind: undefined,
level: undefined,
message: undefined,
position: undefined,
referrer: undefined,
specifier: undefined,
toJSON: [Function: toJSON],
toString: [Function: toString],
name: "ResolveMessage",
[Symbol(Symbol.toPrimitive)]: [Function: toPrimitive]
}
error: script "migrate" exited with code 1 (SIGHUP)
$ bun src/lib/server/database/migrate.ts
ResolveMessage {
stack: "undefined",
query: undefined,
parameters: undefined,
args: [],
types: null,
code: undefined,
importKind: undefined,
level: undefined,
message: undefined,
position: undefined,
referrer: undefined,
specifier: undefined,
toJSON: [Function: toJSON],
toString: [Function: toString],
name: "ResolveMessage",
[Symbol(Symbol.toPrimitive)]: [Function: toPrimitive]
}
error: script "migrate" exited with code 1 (SIGHUP)
6 replies
DTDrizzle Team
Created by thomasmol on 8/27/2023 in #help
Running migrate() in Sveltekit project
I have a migrate.ts file with the script for running migrate(), how would you typically execute this in a sveltekit project? I tried adding it to a npm script: "migrate": "ts-node src/lib/server/database/migrate.ts" but I get errors here (ERR_UNKNOWN_FILE_EXTENSION). Any ideas?
8 replies