Drizzle forcefully dropping ENUMs

I am using a single neon db for 2 of my apps each app has 2 different ENUMs. If from scratch i push the first app it pushes alright But for the second app it asks for new enums creation an upon selection of create new the script tries to drop other enums and gets an error
No config path provided, using default 'drizzle.config.ts'
Reading config file 'D:\Projects\gym_up\drizzle.config.ts'
Using 'postgres' driver for database querying
[✓] Pulling schema from database...
+ st_gender enum will be created
+ st_membership_Type enum will be created
--- all enum conflicts resolved ---

PostgresError: cannot drop type tw_gender because other objects depend on it
at ErrorResponse (file:///D:/Projects/gym_up/node_modules/postgres/src/connection.js:788:26)
at handle (file:///D:/Projects/gym_up/node_modules/postgres/src/connection.js:474:6)
at TLSSocket.data (file:///D:/Projects/gym_up/node_modules/postgres/src/connection.js:315:9)
at TLSSocket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '2BP01',
detail: 'column gender of table tw_tag depends on type tw_gender',
hint: 'Use DROP ... CASCADE to drop the dependent objects too.',
file: 'dependency.c',
line: '1196',
routine: 'reportDependentObjects'
}
No config path provided, using default 'drizzle.config.ts'
Reading config file 'D:\Projects\gym_up\drizzle.config.ts'
Using 'postgres' driver for database querying
[✓] Pulling schema from database...
+ st_gender enum will be created
+ st_membership_Type enum will be created
--- all enum conflicts resolved ---

PostgresError: cannot drop type tw_gender because other objects depend on it
at ErrorResponse (file:///D:/Projects/gym_up/node_modules/postgres/src/connection.js:788:26)
at handle (file:///D:/Projects/gym_up/node_modules/postgres/src/connection.js:474:6)
at TLSSocket.data (file:///D:/Projects/gym_up/node_modules/postgres/src/connection.js:315:9)
at TLSSocket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '2BP01',
detail: 'column gender of table tw_tag depends on type tw_gender',
hint: 'Use DROP ... CASCADE to drop the dependent objects too.',
file: 'dependency.c',
line: '1196',
routine: 'reportDependentObjects'
}
Here are my enums for 2 of my apps:
export const Gender = pgEnum('tw_gender', ['Male', 'Female'])

export const Subscription_Term = pgEnum('tw_subscription_term', [
'Monthly',
'Yearly',
])
export const Gender = pgEnum('tw_gender', ['Male', 'Female'])

export const Subscription_Term = pgEnum('tw_subscription_term', [
'Monthly',
'Yearly',
])
export const Membership_Type = pgEnum("st_membership_Type", [
"Monthly",
"Yearly",
]);

export const Gender = pgEnum("st_gender", ["Male", "Female"]);
export const Membership_Type = pgEnum("st_membership_Type", [
"Monthly",
"Yearly",
]);

export const Gender = pgEnum("st_gender", ["Male", "Female"]);
1 Reply
s.m.haris
s.m.harisOP7d ago
The code is pushing alright but the error keeps popping up

Did you find this page helpful?