So I need something like this to let exposed valid...
# exposed
s
So I need something like this to let exposed validate it's own scheme against itself spring.jpa.hibernate.ddl-auto=validate
e
you could write a test to verify or a build task manually - I don’t think it’s Exposed target to have schema validation built in
s
Yeah I thought about a unit test which inserts 1 item per table and then select first item per table - this should invoke any error if it exists I guess
Not sure what a gradle task could contain though
e
the same - afaik (correct me if I’m wrong) you can literally run anything with Gradle, so just running the same test within a build task could better serve as a “build-time test”
s
I ended up passing an enum to application module to distinguish between normal run and unit test run. When I’m in unit test mode app drops/creates a test database instead of a normal one. I make those inserts/fetches then to validate database schema. This is fine when working locally though, I didn’t bother starting postgres in CI environment, so I just pass the test instead if I detect a CI run. So the safest thing is to run this test as a pre-commit hook so I can’t commit a failing schema. This test takes just 1.5 sec so I guess this is fine
👍 1