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

Same database used in development and test #6

Open
xymbol opened this issue Jun 26, 2018 · 1 comment
Open

Same database used in development and test #6

xymbol opened this issue Jun 26, 2018 · 1 comment

Comments

@xymbol
Copy link

xymbol commented Jun 26, 2018

I can see how this makes setting up CI easier but, in development this configuration will overwrite the development database on every test run. This example is both counterintuitive and against good practice.

Doing a bundle exec rake db:setup confirms this:

$ bundle exec rake db:setup
Created database 'rails_blog'
Database 'rails_blog' already exists
-- enable_extension("plpgsql")
   -> 0.0291s
-- create_table("posts", {:force=>:cascade})
   -> 0.0118s
-- enable_extension("plpgsql")
   -> 0.0255s
-- create_table("posts", {:force=>:cascade})
   -> 0.1633s

Different database names should be used for each environment.

@xymbol xymbol changed the title Don't use same database in development and test Same database used in development and test Jun 26, 2018
@krtschmr
Copy link

krtschmr commented Oct 14, 2019

That's an rails issue, that's why you call it bundle exec rake db:setup RAILS_ENV=test

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

2 participants