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

Add additional shortcuts to the Makefile #2208

Closed
shivankacker opened this issue May 30, 2024 · 5 comments
Closed

Add additional shortcuts to the Makefile #2208

shivankacker opened this issue May 30, 2024 · 5 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@shivankacker
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently the Makefile only contains a limited number of commands. Commands like make migrate that are essential while development are not present.

Describe the solution you'd like

  • If possible, a wildcard (*) command that would run docker compose exec backend bash -c "python manage.py *"
    Other complex commands like make test and make test-coverage can be kept the same as removing them for wildcards does not make sense.

  • Additional shell_plus, db_shell, and reset_test_db and commands

@shivankacker shivankacker added the good first issue Good for newcomers label May 30, 2024
@dhruv-goyal-10
Copy link
Contributor

@skks1212 I think so the following code, covers the changes you suggested.

Commands like migrate, shell_plus & dbshell are covered under wildcard command.
reset_test_db is covered separately.

# Reset the test database and apply migrations
reset_test_db:
	docker compose exec backend bash -c "python manage.py reset_db --noinput"
	docker compose exec backend bash -c "python manage.py migrate"

# Wildcard command to run any Django management command
%:
	docker compose exec backend bash -c "python manage.py $*"

@shivankacker
Copy link
Member Author

@dhruv-goyal-10 would flags and additional data be passed down? For example make migrate facility 0001 should convert to python manage.py migrate facility 0001

@dhruv-goyal-10
Copy link
Contributor

@skks1212 Yep, it will be passed down if the entire command is passed as string.

In your case, make "migrate facility 0001" will work same as running python manage.py migrate facility 0001.

@shivankacker
Copy link
Member Author

shivankacker commented Jun 25, 2024

@dhruv-goyal-10 Thats nice, should I assign you to this issue?

@dhruv-goyal-10
Copy link
Contributor

@skks1212 Yep, you can assign me this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants