usergraphtheory's picture
Sync from erdostack/bench at a7805c45d77258d316383c92bdc9f472498d255f (part 52)
013f624 verified
Raw History Blame Contribute Delete
347 Bytes
CREATE TABLE stop (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
zone INTEGER NOT NULL
);
CREATE TABLE link (
from_stop TEXT NOT NULL REFERENCES stop(id),
to_stop TEXT NOT NULL REFERENCES stop(id),
minutes INTEGER NOT NULL CHECK (minutes > 0),
PRIMARY KEY (from_stop, to_stop)
);
CREATE INDEX link_by_target ON link(to_stop);