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 makefile error if diesel_cli is not installed #144

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,26 @@ db_sqlite:
sqlite3 "$(SQLITE_FILE)" "VACUUM;"
$(MAKE) diesel_sqlite

ensure_diesel:
@command -v diesel >/dev/null 2>&1 || (echo "diesel_cli not installed, can't continue" && exit 1)
Comment on lines +52 to +53
Copy link
Collaborator Author

@v0idpwn v0idpwn Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe we could require ensure_diesel for db. It isn't really required, but in the current setup, the containers are started even if diesel_cli isn't installed, and they aren't automatically killed on error. This could be avoided by depending on ensure_diesel for db.


diesel: $(DIESEL_TARGETS)

diesel_postgres:
diesel_postgres: ensure_diesel
@echo -e $(BOLD)Running Diesel migrations on Postgres database...$(END_BOLD)
while ! diesel migration run --database-url "$(POSTGRES_URL)" --migration-dir "$(POSTGRES_MIGRATIONS)" --config-file "$(POSTGRES_CONFIG)" 2> /dev/null; \
do \
sleep 1; \
done

diesel_mysql:
diesel_mysql: ensure_diesel
@echo -e $(BOLD)Running Diesel migrations on MySQL database...$(END_BOLD)
while ! diesel migration run --database-url "$(MYSQL_URL)" --migration-dir "$(MYSQL_MIGRATIONS)" --config-file "$(MYSQL_CONFIG)" 2> /dev/null; \
do \
sleep 1; \
done

diesel_sqlite:
diesel_sqlite: ensure_diesel
@echo -e $(BOLD)Running Diesel migrations on SQLite database...$(END_BOLD)
while ! diesel migration run --database-url sqlite://"$(SQLITE_FILE)" --migration-dir "$(SQLITE_MIGRATIONS)" --config-file "$(SQLITE_CONFIG)" 2> /dev/null; \
do \
Expand Down