hkg
DTDrizzle Team
•Created by hkg on 7/14/2024 in #help
`drizzle-kit push` trying to remove drizzle's own sequence causing errors
$ bunx drizzle-kit push
drizzle-kit: v0.23.0
drizzle-orm: v0.32.0
No config path provided, using default path
Reading config file '/workspaces/hashira/packages/db/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
Warning You are about to execute current statements:
ALTER TABLE "core_wallet" DROP CONSTRAINT "core_wallet_userId_name_unique";
ALTER TABLE "core_users" ALTER COLUMN "married_to" SET DEFAULT null;
ALTER TABLE "core_task" ALTER COLUMN "identifier" SET DEFAULT gen_random_uuid()::text;
ALTER TABLE "core_wallet" ADD CONSTRAINT "core_wallet_userId_name_unique" UNIQUE("userId","name");
DROP SEQUENCE "drizzle"."__drizzle_migrations_id_seq";
error: cannot drop sequence drizzle.__drizzle_migrations_id_seq because other objects depend on it
at /workspaces/hashira/node_modules/drizzle-kit/bin.cjs:79476:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:121418:26)
at async pgPush (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:124361:13)
at async _Command.<anonymous> (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:131618:7) {
length: 343,
severity: 'ERROR',
code: '2BP01',
detail: 'default value for column id of table drizzle.__drizzle_migrations depends on sequence drizzle.__drizzle_migrations_id_seq',
hint: 'Use DROP ... CASCADE to drop the dependent objects too.',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'dependency.c',
line: '1197',
routine: 'reportDependentObjects'
}
$ bunx drizzle-kit push
drizzle-kit: v0.23.0
drizzle-orm: v0.32.0
No config path provided, using default path
Reading config file '/workspaces/hashira/packages/db/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
Warning You are about to execute current statements:
ALTER TABLE "core_wallet" DROP CONSTRAINT "core_wallet_userId_name_unique";
ALTER TABLE "core_users" ALTER COLUMN "married_to" SET DEFAULT null;
ALTER TABLE "core_task" ALTER COLUMN "identifier" SET DEFAULT gen_random_uuid()::text;
ALTER TABLE "core_wallet" ADD CONSTRAINT "core_wallet_userId_name_unique" UNIQUE("userId","name");
DROP SEQUENCE "drizzle"."__drizzle_migrations_id_seq";
error: cannot drop sequence drizzle.__drizzle_migrations_id_seq because other objects depend on it
at /workspaces/hashira/node_modules/drizzle-kit/bin.cjs:79476:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:121418:26)
at async pgPush (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:124361:13)
at async _Command.<anonymous> (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:131618:7) {
length: 343,
severity: 'ERROR',
code: '2BP01',
detail: 'default value for column id of table drizzle.__drizzle_migrations depends on sequence drizzle.__drizzle_migrations_id_seq',
hint: 'Use DROP ... CASCADE to drop the dependent objects too.',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'dependency.c',
line: '1197',
routine: 'reportDependentObjects'
}
2 replies
DTDrizzle Team
•Created by hkg on 6/2/2024 in #help
Drizzle-kit SSL Error
I've just updated my drizzle-kit to newer version and I'm getting:
and this is my current config
$ bun run --cwd packages/db push
$ drizzle-kit push
drizzle-kit: v0.22.1
drizzle-orm: v0.31.0
No config path provided, using default path
Reading config file '/workspaces/hashira/packages/db/drizzle.config.ts'
Using 'pg' driver for database querying
[⣷] Pulling schema from database...Error: The server does not support SSL connections
at /workspaces/hashira/node_modules/drizzle-kit/bin.cjs:77692:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:119631:26)
at async fromDatabase2 (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:21560:25)
$ bun run --cwd packages/db push
$ drizzle-kit push
drizzle-kit: v0.22.1
drizzle-orm: v0.31.0
No config path provided, using default path
Reading config file '/workspaces/hashira/packages/db/drizzle.config.ts'
Using 'pg' driver for database querying
[⣷] Pulling schema from database...Error: The server does not support SSL connections
at /workspaces/hashira/node_modules/drizzle-kit/bin.cjs:77692:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:119631:26)
at async fromDatabase2 (/workspaces/hashira/node_modules/drizzle-kit/bin.cjs:21560:25)
export default {
schema: "./src/schema/*",
out: "./drizzle/",
dialect: "postgresql",
dbCredentials: {
database: env.POSTGRES_DB,
host: env.POSTGRES_HOST,
password: env.POSTGRES_PASSWORD,
user: env.POSTGRES_USER,
},
strict: true,
verbose: true,
} satisfies Config;
export default {
schema: "./src/schema/*",
out: "./drizzle/",
dialect: "postgresql",
dbCredentials: {
database: env.POSTGRES_DB,
host: env.POSTGRES_HOST,
password: env.POSTGRES_PASSWORD,
user: env.POSTGRES_USER,
},
strict: true,
verbose: true,
} satisfies Config;
6 replies
DTDrizzle Team
•Created by hkg on 4/22/2024 in #help
DrizzleError: Rollback is being rethrown unexpectedly
No matter which error I throw for the rollback - it doesn't work as indented because it bleeds outside the transaction as postgres-js is rethrowing it.
Such simple code results in my top-level error handler being triggered with
const mute = await db.transaction(async (tx) => {
await tx.rollback();
});
const mute = await db.transaction(async (tx) => {
await tx.rollback();
});
DrizzleError: Rollback
Relevant postgres-js line: https://github.com/porsager/postgres/blob/master/src/index.js#L2714 replies