Dynastie/init.sql
2012-07-08 16:23:39 +02:00

13 lines
1.3 KiB
SQL

BEGIN TRANSACTION;
CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), login VARCHAR(255), password VARCHAR(255), email VARCHAR(255), administrator CHAR(1), editor REFERENCES editor(id));
CREATE TABLE editor (name VARCHAR(255));
CREATE TABLE article (id INTEGER PRIMARY KEY, title VARCHAR(255), category REFERENCES category(id) ON DELETE SET NULL, published CHAR(1), creation_date DATE, front_page CHAR(1), author REFERENCES user(id) ON DELETE SET NULL, description TEXT, keywords TEXT);
CREATE TABLE category (name VARCHAR(255) PRIMARY KEY, parent REFERENCES category(id) ON DELETE SET NULL);
CREATE TABLE tag (name VARCHAR(255));
CREATE TABLE tags (article REFERENCES article(id), tag REFERENCES tag(id));
CREATE TABLE comment(id INTEGER PRIMARY KEY, article REFERENCES article(id), parent REFERENCES comment(id), comment_date DATE, author VARCHAR(255), email VARCHAR(255), comment TEXT);
CREATE TABLE blog (id INTEGER PRIMARY KEY, name VARCHAR(255), title VARCHAR(255), description TEXT, keywords TEXT);
CREATE TABLE writers (blog REFERENCES blog(id), user REFERENCES user(id));
-- Administrator with empty password
INSERT INTO user ("name", "login", "password", "administrator") VALUES ("Administrator", "admin", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "1");
COMMIT TRANSACTION;