How do I change my schema without data loss in MySQL ?
Hey everyone, I'm pretty new to SQL so I'm having some disturbing questions in my mind.
How should I proceed when I need to add a new and notNull column to a schema without losing data?
Do I need to set a default ? But then I can't remove the default because it causes data-loss, so I might aswell not use a notNull field, but what if I have to ?
I've been reading about migrations, but I don't really see a big difference between a migration and a db:push (I'm using drizzle + planetscale)
What is the correct way to approach this problem?
Thank you!
How should I proceed when I need to add a new and notNull column to a schema without losing data?
Do I need to set a default ? But then I can't remove the default because it causes data-loss, so I might aswell not use a notNull field, but what if I have to ?
I've been reading about migrations, but I don't really see a big difference between a migration and a db:push (I'm using drizzle + planetscale)
What is the correct way to approach this problem?
Thank you!