Created
December 18, 2011 11:32
-
-
Save vivainio/1493084 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop table if exists blobs; | |
CREATE TABLE blobs ( | |
id INTEGER PRIMARY KEY, | |
format INTEGER, | |
data BLOB | |
); | |
drop table if exists nodes; | |
CREATE TABLE nodes ( | |
id INTEGER PRIMARY KEY, | |
gnx VARCHAR(20), | |
h TEXT, | |
bodyid INTEGER REFERENCES blobs(id) | |
); | |
-- 0 is always root node | |
INSERT INTO nodes (id, h) values (0, '__INVISIBLE_ROOT__'); | |
drop table if exists edges; | |
CREATE TABLE edges ( | |
a INTEGER NOT NULL REFERENCES nodes(id), | |
b INTEGER NOT NULL REFERENCES nodes(id), | |
pos INTEGER NOT NULL, | |
PRIMARY KEY (a, b, pos) | |
); | |
CREATE INDEX a_idx ON edges (a); | |
CREATE INDEX b_idx ON edges (b); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment