#Is there an option to easily clear all tables in dev?

3 messages · Page 1 of 1 (latest)

static berry
#

Is there an option to easily clear all tables in dev?

rugged onyxBOT
#

Hi @static berry. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Yes! There are a few ways to clear all tables in your Convex dev deployment:

CLI One-liner

You can loop through all tables and clear them with:

for tableName in `npx convex data`; do npx convex import --table $tableName --replace -y --format jsonLines /dev/null; done

[YOLO fast MVP]

Or, to clear a single specific table:

npx convex import --table $TABLE --replace --format jsonLines /dev/null

Dashboard

You can also clear tables one at a time via the Convex dashboard by clicking the overflow menu at the top of the data page and selecting "Clear Table". This deletes all documents without removing the table itself. [Dashboard data docs]

Tip: Pair with a Seed Script

After clearing, it's a good practice to re-seed your data. You can maintain a seed mutation (e.g., in convex/init.ts) and run it automatically with convex dev --run init so your dev environment is always in a valid state after a wipe. [Seeding preview deployments]

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: