Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve database seeding #37

Merged
merged 7 commits into from
Jan 16, 2018
Merged

Improve database seeding #37

merged 7 commits into from
Jan 16, 2018

Conversation

irisfaraway
Copy link
Member

@irisfaraway irisfaraway commented Jan 15, 2018

https://eaflood.atlassian.net/browse/WC-167

We need some seed data for the database for the dev environment and for running acceptance tests against. This change switches from loading all seeds in a single script to storing seeds as multiple JSON files and then loading them. This approach should make it easier to add and modify seeds.

https://eaflood.atlassian.net/browse/WC-167

We need some seed data for the database for the dev environment and for running acceptance tests against. This change switches from loading all seeds in a single script to storing seeds as multiple JSON files and then loading them. This approach should make it easier to add and modify seeds.
@irisfaraway irisfaraway self-assigned this Jan 15, 2018
Seeds with regIdentifiers are loaded first. Then ones without regIdentifiers are loaded and assigned new regIdentifiers to 'fill in the gaps'. This change includes a refactor of the CanGenerateRegIdentifier concern to continue incrementing the counter if it would clash with a regIdentifier which was added out of sequence.
@irisfaraway
Copy link
Member Author

@Cruikshanks This is ready for a review. You'll probably want to play around with the seed data, especially adding different regIdentifiers to change the order in which seeds are added.

Hakiri has flagged up an issue – I've looked into this and don't think it is a risk as the value it's concerned about (the regid counter) should only be modified by the application and not by any data from users, etc. What do you think?

@irisfaraway
Copy link
Member Author

We've also got some docs (🎉 ) here: https://github.com/DEFRA/waste-carriers-renewals/wiki/Database-seeding

@irisfaraway irisfaraway merged commit 1d1bab4 into master Jan 16, 2018
@irisfaraway irisfaraway deleted the feature/db-seeding branch January 16, 2018 10:52
@irisfaraway irisfaraway added the enhancement New feature or request label Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants