Coffee11
Coffee117mo ago

Drop table property with index

Hi how to delete a property that has an index and data? Document with ID "k970fhqa6pzjy3cxx04esrty4s6v7bsf" in table "property_features" does not match the schema: Object contains extra field tag that is not in the validator. Object: {category: "amenities", name: "Big roads", slug: "motor-way", tag: "amenities", tags: ["condominium", "house-and-lot", "warehouse", "land"]} Validator: v.object({category: v.optional(v.string()), name: v.string(), slug: v.string(), tags: v.optional(v.array(v.string()))})
2 Replies
ian
ian7mo ago
You have a few options: 1. If this is just during development, you can delete data that doesn't match - this is easiest 2. Push a schema that has tag: v.optional(v.string()) to reflect reality, and then delete the tags - you can use bulk editor on the dashboard to do this, or write a migration in code 3. Turn off schema validation while you push and patch data, if you don't want to add tag as optional. Some posts: https://stack.convex.dev/lightweight-zero-downtime-migrations https://stack.convex.dev/migrating-data-with-mutations https://stack.convex.dev/intro-to-migrations
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!
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.
Coffee11
Coffee11OP7mo ago
thanks @ian

Did you find this page helpful?