How to remove (delete) a column in a table
Hi,
I defined a column in my schema within a nextjs app and saw it in the data tab on the convex dashboard.
I don't want that column anymore and want to remove it from the schema and the table, but now I got an error in the console.
Whats the procedure to achieve this?
Thanks
3 Replies
You'll need to set that field to undefined in every document on the table before removing it from the schema.
Thanks
A few useful links / posts for future readers:
https://search.convex.dev/?q=migration
intro to migrations
doing lightweight ones from the dashboard
full-on migrations like the one above
Convex Developer Search
Search Docs, Stack, Discord all at once
Intro to Migrations
There are as many ways to migrate data as there are databases, but here’s some basic information to set the stage.
Lightweight Migrations
Patch all of your data in your database table with the bulk edit feature on the Convex dashboard, without writing migration code.
Stateful Migrations using Mutations
Online migrations in Convex using mutations. Including a helper to track migration state!