Something went wrong. Try again.
atproto Thingiverse but good
Something went wrong. Try again.
1.6 kB · 34 lines
SQL
at main
1234567891011121314151617181920212223242526272829303132333435-- PM-80: preserve project-scoped membership for shared ordinary Part resources.-- ldraw_resources remains the PM-76 source/byte identity table. Project/path-- belongs here because one source Part may be visible in several Things.CREATE TABLE ldraw_resource_memberships ( resource_uri TEXT NOT NULL, project_uri TEXT NOT NULL, root TEXT NOT NULL, canonical_path TEXT NOT NULL, provenance TEXT NOT NULL, PRIMARY KEY (resource_uri, project_uri, root, canonical_path));CREATE INDEX idx_ldraw_resource_memberships_project_path ON ldraw_resource_memberships(project_uri, root, canonical_path);CREATE INDEX idx_ldraw_resource_memberships_resource ON ldraw_resource_memberships(resource_uri);
-- Migration 009 rows carry one legacy membership on ldraw_resources. Copy it-- forward without rewriting that source table; PM-80 writers use the junction-- for all new memberships and the resolver reads this table exclusively.INSERT OR IGNORE INTO ldraw_resource_memberships (resource_uri, project_uri, root, canonical_path, provenance)SELECT resource_uri, project_uri, root, canonical_path, provenanceFROM ldraw_resources;
-- Hydrant's cursor is globally ordered, but replay/eager paths can deliver a-- record out of order. Keep the newest event per record key so an older update-- or delete cannot overwrite a newer source identity or derived bytes.CREATE TABLE projection_revisions ( did TEXT NOT NULL, collection TEXT NOT NULL, rkey TEXT NOT NULL, seq INTEGER NOT NULL CHECK (seq >= 0), PRIMARY KEY (did, collection, rkey));