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

Possible bug around db:reset #228

Open
etherbob opened this issue Oct 17, 2022 · 2 comments
Open

Possible bug around db:reset #228

etherbob opened this issue Oct 17, 2022 · 2 comments

Comments

@etherbob
Copy link

Apologies in advance if I missed something in the docs, but I didn't see anything about this in the readme or an existing bug:

I would expect db:reset to run the data:schema:load task. When we do a reset the data:version task returns 0 and all our migrations show as down.

Is this intentional behavior (in which case I'd be happy to start a PR around some docs), or a bug?

@josh-levinson
Copy link

Unfortunately, the db:reset is part of the Rails tasks, so it only knows about Rails stuff. So it'll only run db:schema:load because it doesn't know about the data-migration gem. You would have to create a different rake task to include data:schema:load or maybe a way to alias them

@michalwa
Copy link

michalwa commented Oct 4, 2023

I think a viable solution is to enhance the db:setup task:

Rake::Task["db:setup"].enhance do
  Rake::Task["data:schema:load"].invoke
end

However I also found that the data:schema:load messes up the DB environment somehow, and it prevents running db:reset again afterwards. This can be fixed by also invoking db:environment:set after data:schema:load.

It would be nice if the library set this up out of the box though.

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

3 participants