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

Add Rails best practice around migrations and seeds #45

Open
thisismydesign opened this issue Jul 20, 2020 · 0 comments
Open

Add Rails best practice around migrations and seeds #45

thisismydesign opened this issue Jul 20, 2020 · 0 comments

Comments

@thisismydesign
Copy link
Member

thisismydesign commented Jul 20, 2020

https://stackoverflow.com/a/2667747/2771889

avoid seeding in migrations. if you change the model (e.g. add a mandatory field) old migrations will no longer work. either you'd have to update existing migrations, which is ill-advised ("In general, editing existing migrations is not a good idea." https://edgeguides.rubyonrails.org/active_record_migrations.html#changing-existing-migrations), or avoid db:migrate(:*) in favor of db:schema:load.

avoid bin/rails db:create db:migrate && bin/rails db:seed

e.g. if there's a non-optional relation added to an initializer that used to be optional before

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

No branches or pull requests

1 participant