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

Make it easier to spot schema + fixture errors #1928

Merged
merged 1 commit into from
Mar 7, 2024
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
8 changes: 4 additions & 4 deletions lib/IHP/Makefile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ psql: ## Connects to the running postgresql server
@psql -h $$PWD/build/db -d app

db: Application/Schema.sql Application/Fixtures.sql ## Creates a new database with the current Schema and imports Fixtures.sql
echo "drop schema public cascade; create schema public;" | psql -h $$PWD/build/db -d app
psql -h $$PWD/build/db -d app < "${IHP_LIB}/IHPSchema.sql"
psql -h $$PWD/build/db -d app < Application/Schema.sql
psql -h $$PWD/build/db -d app < Application/Fixtures.sql
(echo "drop schema public cascade; create schema public;" | psql -h $${PWD}/build/db -d app) && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at the other make files, we don't use && \

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, but this way, we can stop on error. Otherwise it goes on, as each line is executed in a new subshell.

psql -v ON_ERROR_STOP=1 -h $${PWD}/build/db -d app < "$${IHP_LIB}/IHPSchema.sql" && \
psql -v ON_ERROR_STOP=1 -h $${PWD}/build/db -d app < Application/Schema.sql && \
psql -v ON_ERROR_STOP=1 -h $${PWD}/build/db -d app < Application/Fixtures.sql

dumpdb: dump_db ## Saves the current database state into the Fixtures.sql
dump_db: ## Saves the current database state into the Fixtures.sql
Expand Down
Loading