db:reset
Table of contents
Introduction
db:reset drops every table of the selected product’s database and applies the migrations again from scratch. Use it when the schema needs rebuilding. For fresh data on the same schema, db:seed --reset is enough.
splent db:reset
⚠️ WARNING: This will DROP all tables and empty the protected uploads. Are you sure? [y/N]: y
🗑️ Dropping all tables...
Dropped alembic_splent_feature_notes
Dropped notes
...
✅ All tables dropped.
📋 Recreating splent_migrations table...
The contents of the uploads directory /workspace/my_first_app/instance/protected_uploads have been successfully cleared.
⬆️ Applying migrations for 2 features...
✅ splent_feature_notes → 990210b54b52
✅ splent_feature_reports → 126da35a357f
🎉 Database reset complete.
Every row is lost, and the protected uploads are emptied too, since their rows are gone. The migration files stay.
It drops the alembic_<feature> tables and splent_migrations as well, then migrates in the UVL dependency order that feature:order shows.
Resetting one feature
splent db:reset shop
Reset feature: splent_feature_shop
tables to drop : item, collection, collection_photo, shop_staff
also re-applies: splent_feature_collections, splent_feature_shop_staff (refiners)
Only the feature’s tables go, with those of every declared feature that refines it, directly or through another refiner. Every other feature’s data stays. Use it after you change a model or a refinement.
It lists what it will drop and asks. Then it clears the migration tracking of the feature and its refiners, and applies their migrations again, base first. Uploads are not touched in this mode.
The name must be a declared feature. shop, splent_feature_shop and splent-io/splent_feature_shop@v1.2.0 all work.
Resetting without a prompt
splent db:reset -y
-y or --yes skips the confirmation, as in a script.
Reference
Options
| Option | Description |
|---|---|
FEATURE_NAME |
Optional. Reset only this feature and its refiners |
-y, --yes |
Do not ask for confirmation |
Errors
| Message | What to do |
|---|---|
❌ <feature>: <error> |
A migration failed. The others still run, and the command ends with Error: Migration re-apply failed for: <features> and exit 1. Unlike db:upgrade, it does not retry |
Error: '<name>' is not a feature of <product>. Declared features: ... |
Check the name. Nothing was dropped |
⚠️ '<feature>' owns no tables (nothing to drop). |
It is probably a refinement whose columns live in the base table. Reset the base feature |
Dropped so far: ... and Re-run splent db:reset <feature> once the database is reachable |
The database failed midway. Running it again is safe, since every drop is DROP TABLE IF EXISTS |
⚠️ Uploads were not cleared. The reset continues. |
Empty them with clear:uploads |
Error: Cannot read the features of <product>/pyproject.toml: <reason> |
Fix the TOML. Nothing was dropped |
Requirements
- A selected product (
SPLENT_APP), and a reachable database. - The product is not deployed to production (
SPLENT_ENV=prod), since the CLI would then reach the production database. Go back withsplent product:down --prodandsplent product:up --dev. See the CLI while production is deployed.