BEGIN TRANSACTION;
CREATE TABLE config (
  salt VARCHAR(255)
);
INSERT INTO config VALUES('NeVeRcHaN');
CREATE TABLE discussions (
  id        INTEGER NOT NULL PRIMARY KEY,
  post_id   INTEGER,
  title     VARCHAR(255),
  last_age  DATETIME,
  channel   VARCHAR(255),

  FOREIGN KEY (post_id) REFERENCES posts(id)
--FOREIGN KEY (channel) REFERENCES channels(name)
);
INSERT INTO discussions VALUES(1,NULL,'New Fugi installation','2006-01-26 22:14:14',NULL);
CREATE TABLE posts (
  id        INTEGER NOT NULL PRIMARY KEY,
  content   TEXT,
  author    VARCHAR(64),
  tripcode  CHAR(6),
  created   DATETIME,
  parent    INTEGER,
  discussion_id INTEGER,
  ipaddress CHAR(16) NOT NULL,
  sage      BOOL DEFAULT FALSE,

  FOREIGN KEY (parent) REFERENCES posts(id),
  FOREIGN KEY (discussion_id) REFERENCES discussions(id)
);
INSERT INTO posts VALUES(1,'Gratulations for a new, successful Fugi installation.

Brought to you by Christian Neukirchen, Fugi main developer.','chris2','t2wdu7','2006-01-26 22:12:09',NULL,1,'127.0.0.1','FALSE');
INSERT INTO posts VALUES(2,'If something is unclear, please have a look at the documentation, linked to on the bottom of this site.','chris2','t2wdu7','2006-01-26 22:13:24',1,1,'127.0.0.1','FALSE');
INSERT INTO posts VALUES(3,'P.S.: Please mail bug-reports, patches, feature requests and ideas for improvement to chneukirchen@gmail.com','chris2','t2wdu7','2006-01-26 22:14:14',1,1,'127.0.0.1','FALSE');
CREATE TABLE threads (
  id        INTEGER NOT NULL PRIMARY KEY,
  head      INTEGER,
  title     VARCHAR(255),
  last_age  DATETIME,
  channel   VARCHAR(255),

  FOREIGN KEY (head) REFERENCES posts(id)
--FOREIGN KEY (channel) REFERENCES channels(name)
);
INSERT INTO threads VALUES(1,1,'First Fugi thread','2006-01-17 18:05:29','meta');
INSERT INTO threads VALUES(2,8,'Second Fugi thread :-)','2006-01-17 18:05:29','meta');
CREATE INDEX discussion_by_post_id ON discussions (post_id);
CREATE INDEX post_by_disussion_id ON posts (discussion_id);
COMMIT;
