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

Conversation

AronNovak
Copy link
Contributor

make db right now silently moves on if there's an error in the Schema or in the Fixture. It should not be like that.

@amitaibu
Copy link
Collaborator

amitaibu commented Mar 5, 2024

@AronNovak Thanks. Can you share a screenshot of how it will look now

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.

@AronNovak
Copy link
Contributor Author

AronNovak commented Mar 5, 2024

@amitaibu

INSERT 0 1
INSERT 0 1
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
INSERT 0 1
ALTER TABLE
ALTER TABLE
INSERT 0 1
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
INSERT 0 1
ALTER TABLE
ERROR:  relation "public.lm_example_table_foo" does not exist
make: *** [/nix/store/scfcsc0fqpz9gji555wzzzsa0hpnnk9w-source/lib/IHP/Makefile.dist:117: db] Error 3
 aaron   main  ~  gizra  client-app  2  

Most of all, it has exit code 2, not 0 and the error is immediately visible.
Without this PR, the exit code is 0 and the error is buried in other output lines.

@amitaibu
Copy link
Collaborator

amitaibu commented Mar 5, 2024

Thanks, I was missing such a feature 👍

Copy link
Member

@mpscholten mpscholten left a comment

Choose a reason for hiding this comment

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

Thanks 👍 good addition

@mpscholten mpscholten merged commit c526aeb into digitallyinduced:master Mar 7, 2024
2 checks passed
@AronNovak AronNovak deleted the db-stop-on-error branch March 19, 2024 12:39
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.

3 participants