Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

possible to create test DB based on existing DB schema? #313

Open
armhold opened this issue Nov 27, 2017 · 0 comments
Open

possible to create test DB based on existing DB schema? #313

armhold opened this issue Nov 27, 2017 · 0 comments

Comments

@armhold
Copy link

armhold commented Nov 27, 2017

Rails has a feature whereby the foo_test database is dropped and then re-created based on the current foo schema, prior to running tests. This allows for things like integration tests that hit the database, and helps keep test runs from interfering with each other by leaving behind crud. Rather than running individual migrations, I believe Rails just copies the schema from foo.

Is there a way to do this (or something close to it) with migrate? Not sure how feasible it is to implement this programmatically in a cross-db fashion, but it sure would be nice to have.

For the moment, I just use the following command line with postgres:

$ dropdb foo_test && createdb foo_test && pg_dump -s foo | psql foo_test

I'd love to know how other people are currently solving this problem. Thanks.

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