Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Initial implementation of database and model field checker. #3452
We've now had at least two instances of deployed systems breaking because the application attempted to query a model that contained a
As a reminder, Pop requires that struct fields that map to nullable database columns be defined either as pointers or using its custom null types. Otherwise, there will be scan errors such as the one addressed by #3439.
As a followup to that PR, I did a little manual checking of models. There were enough mismatches that I thought it would be good to have an automated way to keep an eye on this.
This PR adds a tool that will check that our model struct definitions and database tables are in alignment. It should probably get wrapped in a
Eventually we might want to add this to CI, but we'll have to contend with the existing issues first.
$ go run cmd/compare-db-to-models/main.go
You should see something like this:
Code Review Verification Steps