Skip to content

Instantly share code, notes, and snippets.

@lthms
Created September 13, 2018 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lthms/bef9dcdb4e079e0ff8cfe2201f5a0cb3 to your computer and use it in GitHub Desktop.
Save lthms/bef9dcdb4e079e0ff8cfe2201f5a0cb3 to your computer and use it in GitHub Desktop.
CREATE TABLE entities (
id SERIAL PRIMARY KEY,
time INT4RANGE,
class SMALLINT NOT NULL
);
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
language INT2 NOT NULL,
raw TEXT NOT NULL,
rendered TEXT NOT NULL
);
CREATE TABLE characters (
id SERIAL PRIMARY KEY,
entity_id INTEGER NOT NULL REFERENCES entities,
name VARCHAR(80) NOT NULL,
history INTEGER NOT NULL REFERENCES documents
);
CREATE TABLE relationships (
id SERIAL PRIMARY KEY,
origin INTEGER NOT NULL REFERENCES characters,
destination INTEGER NOT NULL REFERENCES characters,
during INT4RANGE,
description INTEGER NOT NULL REFERENCES documents
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment