summaryrefslogtreecommitdiffstats
path: root/notes/data_model.md
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-04-13 16:01:33 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-04-13 16:01:33 -0700
commit5cdd3d34f1932197fdd81d9b03570767f85eebf4 (patch)
treee796c37ae36507b978bb63ce83cfb757cb63719d /notes/data_model.md
parent0a9d59f33a3bef94f6b57f303fab1fa71cfcafd4 (diff)
downloadfatcat-5cdd3d34f1932197fdd81d9b03570767f85eebf4.tar.gz
fatcat-5cdd3d34f1932197fdd81d9b03570767f85eebf4.zip
notes/docs cleanups
Diffstat (limited to 'notes/data_model.md')
-rw-r--r--notes/data_model.md92
1 files changed, 92 insertions, 0 deletions
diff --git a/notes/data_model.md b/notes/data_model.md
new file mode 100644
index 00000000..fe21b533
--- /dev/null
+++ b/notes/data_model.md
@@ -0,0 +1,92 @@
+
+## Cookbook
+
+To create a new works:
+
+ login/create account
+
+ match/lookup on first work; if found, modify not create
+ TODO: match/lookup on files?
+
+ new edit group (under account; wip)
+ new edit (under group)
+
+ match/lookup on all creators
+ match/lookup on all refs
+ TODO: match/lookup on files?
+ match/lookup container
+
+ new work_rev (linked to edit)
+ new work_ident (linked to rev; not-live)
+ contributor stubs/links
+ new release_rev (linked to work_ident)
+ new release_ident (linked to rev; not-live)
+ contributor stubs/links
+ ref stubs/links
+ new file_rev
+ new file_ident
+
+ set edit group state to "review"
+
+ set edit group state to "accepted"
+ set all ident flags to "live"
+
+
+To edit, eg, a contributor:
+
+ new edit group (under account; wip)
+ new edit (under group)
+
+ create contributor_rev row (and relationship rows)
+
+ set edit group state to "review"
+
+ set edit group state to "accepted"
+ point ident row to new rev
+
+
+Accept edit group:
+
+ for each edit:
+ update entity ident state (activate, redirect, delete)
+ ? mark revision/edit as immutable
+ ? append log/changelog row
+ update edit group state
+
+## Entity Schema
+
+Each entity type has tables:
+
+ _rev
+ core representation of a version of the entity
+
+ _ident
+ persistant, external identifier
+ allows merging, unmerging, stable cross-entity references
+
+ _edit
+ represents change metadata for a single change to one ident
+ needed because an edit alwasy changes ident, but might not change rev
+
+ _log
+ history of when edits were actually applied
+ allows fast lookups of history of an entity (ident)
+ unnecessary if we keep a log of edit group accepts?
+ punt on this for now
+
+## Entity States
+
+ wip (not live; not redirect; has rev)
+ activate
+ active (live; not redirect; has rev)
+ redirect
+ delete
+ redirect (live; redirect; rev or not)
+ split
+ delete
+ deleted (live; not redirect; no rev)
+ redirect
+ activate
+
+ "wip redirect" or "wip deleted" are invalid states
+