Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Clean up migration with seeding #344

Open
pgwillia opened this issue Mar 3, 2020 · 0 comments
Open

Clean up migration with seeding #344

pgwillia opened this issue Mar 3, 2020 · 0 comments

Comments

@pgwillia
Copy link
Member

pgwillia commented Mar 3, 2020

I guess my only concern is if a new developer joins this project and they need to create/migrate their local DB or anytime you blow away your current DB and start fresh (which I personally do every time I seed/migrate my DB which happens quite often) you will run these migrations which will seed the DB. This is because you start from a brand new DB and need to run every single migration since the projects inception. Which means you technically have to keep this up to date as well. So you will have to keep db/migrate/202002/circulation_rule.yml file in this repo forever and this seeding script in working condition or else this migration will fail.

Maybe why it's rare to see complicated seeding or other scripts in migration files as you want to keep migrations for simply schema changes or change existing data.

If it's a one time thing that we want for production, then maybe that should be a temporary rake task which gets ran once in production to seed the new tables. Then afterwards we can remove these files and the rake task and never have to think about this stuff again. If its not a one time thing and this is data that is required for the app (e.g you have a dropdown menu on a form populated from a DB table), then that should be in the seeds.

#343 (comment)

I suppose the other option is leave these how they are. After they get ran in production, come back and cleanup all the scripts for seeding in these migrations and remove the yaml files? This could work too and removes my concerns. Plus could make Unix team job easier then having them run one time rake task

#343 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant