Genio
Genio
DTDrizzle Team
Created by Genio on 1/30/2025 in #help
Drizzle dismisses existing views even when told it exists
I have a view in my database. This view is made via a normal SQL query. Since views dont get pushed via
npx drizzle-kit push
npx drizzle-kit push
i decided to defined it with
export const EventAttendeesView = pgView(
"event_stats_view",
{},
).existing();
export const EventAttendeesView = pgView(
"event_stats_view",
{},
).existing();
so whenever i push schema changes drizzle doesnt prompt me to drop the table to make changes. However, even after putting the view in my schema.ts, whenever i push i still get a prompt to drop the view! I would appreciate it if i could get a calrafication on how to properly handle this. Thank you! edit: logs
➜ ✗ npx drizzle-kit push
drizzle-kit: v0.21.4
drizzle-orm: v0.30.10

No config path provided, using default path
Reading config file '/Users/genio/Developer/drizzle.config.ts'
Using 'postgres' driver for database querying
[✓] Pulling schema from database... Warning Found data-loss statements:
· You're about to delete event_stats_view table with 19 items

THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED

Do you still want to push changes?
[x] All changes were aborted
➜ ✗ npx drizzle-kit push
drizzle-kit: v0.21.4
drizzle-orm: v0.30.10

No config path provided, using default path
Reading config file '/Users/genio/Developer/drizzle.config.ts'
Using 'postgres' driver for database querying
[✓] Pulling schema from database... Warning Found data-loss statements:
· You're about to delete event_stats_view table with 19 items

THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED

Do you still want to push changes?
[x] All changes were aborted
3 replies
DTDrizzle Team
Created by Genio on 6/24/2024 in #help
[ERROR] TypeError: Cannot read properties of undefined (reading 'toString')
I keep getting this error when i run drizzle-kit push. I dont know if it has anything to do with my schema
> drizzle-kit push

drizzle-kit: v0.21.4
drizzle-orm: v0.30.10

No config path provided, using default path
Reading config file '/Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/drizzle.config.ts'
Using 'postgres' driver for database querying
[⣽] Pulling schema from database.../Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/node_modules/drizzle-kit/bin.cjs:16161
const columnDefaultAsString = column7.column_default.toString();
^

TypeError: Cannot read properties of undefined (reading 'toString')
at defaultForColumn (/Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/node_modules/drizzle-kit/bin.cjs:16161:60)
at /Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/node_modules/drizzle-kit/bin.cjs:15992:36
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
> drizzle-kit push

drizzle-kit: v0.21.4
drizzle-orm: v0.30.10

No config path provided, using default path
Reading config file '/Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/drizzle.config.ts'
Using 'postgres' driver for database querying
[⣽] Pulling schema from database.../Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/node_modules/drizzle-kit/bin.cjs:16161
const columnDefaultAsString = column7.column_default.toString();
^

TypeError: Cannot read properties of undefined (reading 'toString')
at defaultForColumn (/Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/node_modules/drizzle-kit/bin.cjs:16161:60)
at /Users/genio/Developer/INVE-APPS/INVE-API/kfupm-global-todo/node_modules/drizzle-kit/bin.cjs:15992:36
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
17 replies