Closed cb1kenobi closed 1 month ago
This should be fixed in drizzle-kit@0.21.3
. If the issue persists, feel free to reopen it!
Hi I'm still experiencing this issue on drizzle-kit: v0.22.1 drizzle-orm: v0.31.0
Before I upgrade to 0.22.1, this issue doesn't occur, I was at: drizzle-kit: v0.21.2 drizzle-orm: v0.30.10
After upgrading, this issue happened.
$ npx drizzle-kit migrate
drizzle-kit: v0.22.1
drizzle-orm: v0.31.0
No config path provided, using default path
Reading config file '/Users/weixuan/git/peach-icon/drizzle.config.ts'
Using 'pg' driver for database querying
[âŁ] applying migrations...error: column "authorid" does not exist
at /Users/weixuan/git/peach-icon/node_modules/drizzle-kit/bin.cjs:77692:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at <anonymous> (/Users/weixuan/git/peach-icon/node_modules/src/pg-core/dialect.ts:89:7)
at NodePgSession.transaction (/Users/weixuan/git/peach-icon/node_modules/src/node-postgres/session.ts:155:19)
at PgDialect.migrate (/Users/weixuan/git/peach-icon/node_modules/src/pg-core/dialect.ts:82:3)
at migrate (/Users/weixuan/git/peach-icon/node_modules/src/node-postgres/migrator.ts:10:2) {
length: 98,
severity: 'ERROR',
code: '42703',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'indexcmds.c',
line: '1884',
routine: 'ComputeIndexAttrs'
}
Hi I'm also experiencing this issue on drizzle-kit: v0.22.7 drizzle-orm: v0.31.2
[ 7/10] COPY ./drizzle.config.ts ./ [done: 50ms]
[ 8/10] RUN npx tsc [done: 1.82s]
[ 9/10] RUN npx drizzle-kit generate
â drizzle-kit: v0.22.7
â drizzle-orm: v0.31.2
â
â No config path provided, using default 'drizzle.config.ts'
â Reading config file '/usr/src/app/drizzle.config.ts'
â node:internal/modules/cjs/loader:1212
â const err = new Error(message);
â ^
â
â Error: Cannot find module './src/main.js'
â Require stack:
â - /usr/src/app/drizzle.config.ts
â - /usr/src/app/node_modules/drizzle-kit/bin.cjs
â at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
â at Module._resolveFilename (/usr/src/app/node_modules/drizzle-kit/bin.cjs:19960:40)
â at Module._load (node:internal/modules/cjs/loader:1038:27)
â at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
â at Module.require (node:internal/modules/cjs/loader:1297:12)
â at require (node:internal/modules/helpers:123:16)
â at Object.<anonymous> (/usr/src/app/drizzle.config.ts:3:33)
â at Module._compile (node:internal/modules/cjs/loader:1460:14)
â at Module._compile (/usr/src/app/node_modules/drizzle-kit/bin.cjs:17464:30)
â at Module._extensions..js (node:internal/modules/cjs/loader:1544:10) {
â code: 'MODULE_NOT_FOUND',
â requireStack: [
â '/usr/src/app/drizzle.config.ts',
â '/usr/src/app/node_modules/drizzle-kit/bin.cjs'
â ]
â }
â
â Node.js v22.3.0
ERROR IN: [ 9/10] RUN npx drizzle-kit generate
Build Failed: ImageBuild: process "/bin/sh -c npx drizzle-kit generate" did not complete successfully: exit code: 1
â
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.2
Describe the Bug
When running
drizzle-kit migrate
, if the migration fails, the command does not exit with a non-zero exit code. It exits with code0
. This is critical because if migrations fail, we need a non-zero exit code to stop CI from continuing.In our case, we managed to get the migration to fail when Drizzle attempts to create an index on a column that does not exist. Please note that the error below is not related to this issue.
As a workaround, we use a script that calls
migrate()
and use acatch
to exit 1.Expected behavior
If a migration fails, the command should exit with a non-zero exit code such as
1
.Environment & setup
This issue is reproducible on macOS 14.4.1, Node.js 20.11.0, and using Neon as well as on our GitHub workflow using Ubuntu.