CREATE TABLE "workspace" ( "id" int, "title" varchar(255) ); CREATE TABLE "category" ( "id" int PRIMARY KEY, "term" varchar(255), "label" varchar(255), "collection_id" int FOREIGN KEY("collection_id") REFERENCES "collection" ("id") ); CREATE TABLE "collection" ( "id" int, "title" varchar(255), "workspace_id" int FOREIGN KEY("workspace_id") REFERENCES "workspace" ("id") ); CREATE TABLE "accept" ( "id" int, "mime_type" varchar(255), "collection_id" int FOREIGN KEY("collection_id") REFERENCES "collection" ("id") ); CREATE TABLE "entry" ( "id" int, "title" varchar(255), "summary" varchar(255), "type" varchar(255), "content" varchar(255), "rights" varchar(255), "draft" bool, "updated" datetime, "published" datetime, "collection_id" int FOREIGN KEY("collection_id") REFERENCES "collection" ("id") ); CREATE TABLE "mediaentry" ( "id" int, "entry_id" int FOREIGN KEY("entry_id") REFERENCES "entry" ("id") ); CREATE TABLE "person" ( "id" int, "name" varchar(255), "email" varchar(255), "uri" varchar(255) ); CREATE TABLE "author" ( "entry_id" int FOREIGN KEY("entry_id") REFERENCES "entry" ("id"), "person_id" int FOREIGN KEY("person_id") REFERENCES "person" ("id") ); CREATE TABLE "entry_category" ( "entry_id" int FOREIGN KEY("entry_id") REFERENCES "entry" ("id"), "category_id" int FOREIGN KEY("category_id") REFERENCES "category" ("id") ); CREATE TABLE "contributor" ( "entry_id" int FOREIGN KEY("entry_id") REFERENCES "entry" ("id"), "person_id" int FOREIGN KEY("person_id") REFERENCES "person" ("id") ); CREATE TABLE "link" ( "id" int, "title" varchar(255), "href" varchar(255), "rel" varchar(255), "entry_id" int FOREIGN KEY("entry_id") REFERENCES "entry" ("id") ); CREATE TABLE "source" ( "entry_id" int FOREIGN KEY("entry_id") REFERENCES "entry" ("id"), "source_entry_id" int FOREIGN KEY("source_entry_id") REFERENCES "entry" ("id") );