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
2 Replies
Genio
GenioOP5w ago
Bump
TOSL
TOSL5w ago
Did you create a materialized view original?

Did you find this page helpful?