How to change schema without losing data?

I want to change my schema & add a new field hidden: boolean("hidden").notNull().default(false), My current schema looks like:
id: serial('id').primaryKey(),
slug: varchar('slug', { length: 64 }).unique().notNull(),
title: varchar('title', { length: 64 }).unique().notNull(),
content: text('content').notNull(),
createdAt: timestamp('created_at').defaultNow(),
lastEdit: timestamp('last_edit').defaultNow(),
readTime: smallint('read_time').notNull()
id: serial('id').primaryKey(),
slug: varchar('slug', { length: 64 }).unique().notNull(),
title: varchar('title', { length: 64 }).unique().notNull(),
content: text('content').notNull(),
createdAt: timestamp('created_at').defaultNow(),
lastEdit: timestamp('last_edit').defaultNow(),
readTime: smallint('read_time').notNull()
Now whenever I edit my schema the data from my supabase(postgres) database gets deleted. How can I change the schema while also preserving all the rows in my database??
1 Reply
textYash
textYashOP•8mo ago
Umm... does anyone know.. I kinda need a little help? 😅 I just realized that I should be reading the alter table sql commands spit out by drizzle... SOLVED
Want results from more Discord servers?
Add your server