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