Skip to content
This repository has been archived by the owner on Mar 24, 2019. It is now read-only.

New data model #62

Closed
wants to merge 9 commits into from
Closed

New data model #62

wants to merge 9 commits into from

Conversation

philandstuff
Copy link
Contributor

This isn't ready for merging yet, I'm just raising a PR to show my working.

All the tests pass but I haven't implemented the "previous versions" functionality, and the findByKV method only works for the primary key field.

The /hash/<record-hash> route doesn't fit the new data model very well because it no longer uniquely identifies a single version of a record, so I've added a /version/<version-hash>/<record-primary-key> route to identify a specific version of a record. I also don't do anything with the SortBy parameters so that will need to be fixed too.

I'll talk about this at standup on monday.

The version hash should include information about the parent of the
version.

The initial version only needs to be inserted if the table is empty.
Turns out this is exactly the same as save.  Convenient!
Using a LEFT JOIN caused toOptionalRecord to blow up with a
NullPointerException, because it causes the query to return rows with
nulls.  INNER JOIN instead causes the query to return 0 rows if the
lateral select doesn't find anything.
Finding by record hash in this new data model doesn't fit very well --
it seems a better fit to find by version hash + primary key.  This will
also make it easier to find previous versions of a record.
@philandstuff
Copy link
Contributor Author

closing this as it's served its educational purpose.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant