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

Makefile command for seeding a db instead of install #41

Open
johndwells opened this issue May 12, 2022 · 2 comments
Open

Makefile command for seeding a db instead of install #41

johndwells opened this issue May 12, 2022 · 2 comments

Comments

@johndwells
Copy link
Contributor

At a minimum something like this:

install: up build
  ddev exec php craft setup/app-id \
    $(filter-out $@,$(MAKECMDGOALS))
  ddev exec php craft setup/security-key \
    $(filter-out $@,$(MAKECMDGOALS))
  ddev import-db --src=seed.sql
  ddev exec php craft up

But it might be cool to modify install to accept a flag? e.g. install --seed=snapshot.sql

@johndwells
Copy link
Contributor Author

It might also be worth calling ddev exec php craft project-config/write so that the files can be committed.

@johndwells
Copy link
Contributor Author

My original comment was terrible and not accurate. Here's more what I think will work:

seed: up build
  ddev exec php craft setup/app-id \
    $(filter-out $@,$(MAKECMDGOALS))
  ddev exec php craft setup/security-key \
    $(filter-out $@,$(MAKECMDGOALS))
  ddev import-db --src=seed.sql
  ddev exec php craft up
  ddev exec php craft project-config/write

Still need to figure out how to pass the filename/path of the SQL file in as a flag when calling it. Then I can explore how to integrate it into the install command.

I do see value in having both - calling seed on an existing project can "reset" it to a new state, so can be called anytime, whereas "install" is assuming it's from scratch.

In which case, the setup calls in seed may go away and be incorporated into the install... Interesting things to think about.

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