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

Document how to seed/reset the db in dev #1178

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

michielbdejong
Copy link
Member

@madoleary do you know how to do this?

  • Are you working on the latest release?
  • Have you tested it locally?
  • Please explain your change
  • I have opened a Jira Issue for this Pull Request
  • My Squashed Commit Message Contains the Issue Key e.g Feature: EDIT-12 Added XXX
    Thanks !

@madoleary do you know how to do this?
@michielbdejong michielbdejong changed the title This isn't working Document how to seed/reset the db in dev Sep 19, 2024
@madoleary
Copy link
Contributor

madoleary commented Sep 19, 2024

Hi @michielbdejong, I found this, which seems to be our problem: https://stackoverflow.com/questions/39135919/docker-compose-rails-rake-dbreset-fails-cannot-drop-the-currently-open-databa

TL;DR -- the fact that our development database was named postgres was creating conflicts

I renamed it to phoenix_development, but you'll have to run docker-compose build to incorporate the changes.

Also, you'll need to create the phoenix_development database via the postgres container db and psql. When you exec into the container, make sure you're going in as the postgres user: docker exec -ti -u postgres db bash.

I'd be interested in automating that step.

If you still run into problems with db:reset, try these one after the other: db:drop db:create db:migrate db:seed

@madoleary
Copy link
Contributor

madoleary commented Sep 19, 2024

Not super related, but there's also a rake task for creating the document types: docker exec -ti edittosdrorg_web_1 bundle exec rake document_types:create_document_types

I can work this into the seed, if preferable?

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

Successfully merging this pull request may close these issues.

2 participants