diddi- / flask-seeder

Flask extension for seeding database
32 stars 11 forks source link

Rollback command #6

Open Matfork opened 4 years ago

Matfork commented 4 years ago

Hello, Thanks for your awesome seeder implementation. I've been checking it and using it. I was wondering if there is a possibility to add a rollback command which would work as the 'downgrade' command in migrations.

This would help to rollback the latest seed so we can modify it and run it again without the need to go into database and clean tables manually. Also rollback --all would help clear all seeds in case we'd need to run them from scratch

I think i'd be a great improvement. Thanks!

diddi- commented 4 years ago

Sounds like an interesting idea. Would it be a specific Seeder (for example a User seeder) you'd rollback or specific runs of the same Seeder (for example the third run of User seeder)?

Matfork commented 4 years ago

It would be based on the latest seeder run, an identifier would be needed (which can be the latest priority value assuming all your seeders have an increment value), but maybe it will involve a file-storage mechanism to keep track of seeders run.

Trying to rollback a specific seeder would be great but I think it can become complex when there are dependencies between seeders.