emencia / diskette

💾 Export and import Django application data and medias
https://diskette.readthedocs.io/
MIT License
1 stars 0 forks source link

Command check #9

Open sveetch opened 8 months ago

sveetch commented 8 months ago

Is your feature request related to a problem? Please describe.

Currently, the diskette configuration settings are only validated when dumping or loading.

Describe the solution you'd like

Current behavior is working but it could be more helpful to diagnostic invalid configuration without to dump or load anything.

New command diskette_check would be able to:

This will never try to hint about data size since it could be stressful for database to count on everything.

sveetch commented 8 months ago

Adding a new command for this was impractical and not very DRY to implement.

So instead, the existing command dump and load will include a new option --check to perform a dry-run.

Since these command already perform validations, we can use the same routine but without writing, querying or loading anything.

The check option for dump has been implemented and tested in v0.3.3-pre.1

sveetch commented 3 weeks ago

Finally reopening this since i found a check command would nice in some situations for debugging.

It should easily find all installed app models then check if there are excluded from dump so in last resort user can explicitly see that some useful model are ignored.

For context, i've faced loading failures from a dump because the app was defining explicitely models. But since the definition creation the app has evolved with new models that were so excluded from dump.

Since these models were used in foreignkey from other models, the loading failed with a laconic message "Integrity Error: Foreign key etc..", that it took me too much time and effort to understand that i was missing new models in definitions. A check command that made me listing all defined models would have helped.

Also we could check about migrations. And maybe a somewhat hardcoded check about permissions and contenttypes.