Schema Dump command #152
Labels
feature request
A feature that does not yet exist but will be a good addition to the library
medium
These issues are geared for people who have contributed to the project before
It would be helpful to have a command that can generate a dump of the current database schema after the latest migrations. Ideally the format of the file will be similar to that of the database migration files and can be used both to review the schema of the database as well as potentially used to create a new version of the database without needing to run through each migration again (with a schema load command, perhaps). Reapplying all migrations can be fragile and time consuming as a project develops over time. Having a schema file lets you remove old migrations after they have been applied without losing the information in your project.
Ideally this file would be automatically regenerated every time you run a migration. Being able to generate it on demand would be a start.
I am proposing that the command would create a schema.py, similar to Ruby on Rail's schema.rb. The Ruby Guide explains Schema Dumping and its usefulness as well as how it relates to migrations. It says this about the schema file:
Although the database itself is obviously the true source of the schema (which is why Rails also allows for dumping in a DB specific format), having the schema in the ORM format lets you apply it across database engines and shortcut lengthy migrations.
The text was updated successfully, but these errors were encountered: