How can i update a table in convex with
How can i update a table in convex with a new field?
7 Replies
you can add a column to that table in the schema.ts file
Yes, but then it has conflicts with the existing data. and i dont want to have it optional.
Can you say more about your situation?
Are you trying to preserve important data? If so, I think you need to do a update of data (for that new column) for each document.
If you are rapidly developing, you can stop schema validation on that particular table, i.e. take the table out of the schema.ts
You can leave it optional then fill it then make it required again
I found a way. First creating an Optional Field, set it to a value, and then remove the Optional
Genius
Yes. I can now see how my message didn’t implicitly convey that.
I think some of the alter table stuff isn’t intuitive because fundamentally, I think convex often prioritizes preventing MySQL foot guns over exposing easy alter table statements. You could have a simple alter table add column experience, but then accidentally cause performance issues by updating every row under the hood.