X-Git-Url: http://git.hcoop.net/hcoop/zz_old/portal.git/blobdiff_plain/29c3cc58c530ac59a4c262c4399311595cca9d8f..453d75799fdab30af3360c84ee5dfd308aa1fb92:/tables.sql

diff --git a/tables.sql b/tables.sql
index b4996bb..d3554bc 100644
--- a/tables.sql
+++ b/tables.sql
@@ -134,3 +134,104 @@ CREATE TABLE Link(
 
 CREATE SEQUENCE LinkSeq START 1;
 
+CREATE TABLE SupCategory(
+	id INTEGER PRIMARY KEY,
+	grp INTEGER NOT NULL,
+	name TEXT NOT NULL,
+	descr TEXT NOT NULL,
+	FOREIGN KEY (grp) REFERENCES WebGroup(id) ON DELETE CASCADE);
+
+CREATE SEQUENCE SupCategorySeq START 1;
+
+CREATE TABLE SupIssue(
+	id INTEGER PRIMARY KEY,
+	usr INTEGER NOT NULL,
+	cat INTEGER NOT NULL,
+	title TEXT NOT NULL,
+	priv BOOLEAN NOT NULL,
+	status INTEGER NOT NULL,
+	stamp TIMESTAMP NOT NULL,
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE,
+	FOREIGN KEY (cat) REFERENCES SupCategory(id) ON DELETE CASCADE);
+
+CREATE SEQUENCE SupIssueSeq START 1;
+
+CREATE TABLE SupPost(
+	id INTEGER PRIMARY KEY,
+	usr INTEGER NOT NULL,
+	iss INTEGER NOT NULL,
+	body TEXT NOT NULL,
+	stamp TIMESTAMP NOT NULL,
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE,
+	FOREIGN KEY (iss) REFERENCES SupIssue(id) ON DELETE CASCADE);
+
+CREATE SEQUENCE SupPostSeq START 1;
+
+CREATE TABLE SupSubscription(
+	usr INTEGER NOT NULL,
+	cat INTEGER NOT NULL,
+	PRIMARY KEY (usr, cat),
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE,
+	FOREIGN KEY (cat) REFERENCES SupCategory(id) ON DELETE CASCADE);
+
+CREATE TABLE Apt(
+	id INTEGER PRIMARY KEY,
+	usr INTEGER NOT NULL,
+	data TEXT NOT NULL,
+	msg TEXT NOT NULL,
+	status INTEGER NOT NULL,
+	stamp TIMESTAMP NOT NULL,
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE);
+
+CREATE SEQUENCE AptSeq START 1;
+
+CREATE TABLE Domain(
+	id INTEGER PRIMARY KEY,
+	usr INTEGER NOT NULL,
+	data TEXT NOT NULL,
+	msg TEXT NOT NULL,
+	status INTEGER NOT NULL,
+	stamp TIMESTAMP NOT NULL,
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE);
+
+CREATE SEQUENCE DomainSeq START 1;
+
+CREATE TABLE MailingList(
+	id INTEGER PRIMARY KEY,
+	usr INTEGER NOT NULL,
+	data TEXT NOT NULL,
+	msg TEXT NOT NULL,
+	status INTEGER NOT NULL,
+	stamp TIMESTAMP NOT NULL,
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE);
+
+CREATE SEQUENCE MailingListSeq START 1;
+
+CREATE TABLE DirectoryPref(
+	usr INTEGER PRIMARY KEY,
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE);
+
+CREATE TABLE MemberApp(
+	id INTEGER PRIMARY KEY,
+	name TEXT NOT NULL,
+	rname TEXT NOT NULL,
+	email TEXT NOT NULL,
+	forward BOOLEAN NOT NULL,
+	uses TEXT NOT NULL,
+	other TEXT NOT NULL,
+	passwd TEXT NOT NULL,
+	status INTEGER NOT NULL,
+	applied TIMESTAMP NOT NULL,
+	confirmed TIMESTAMP,
+	decided TIMESTAMP,
+	msg TEXT NOT NULL);
+
+CREATE SEQUENCE MemberAppSeq START 1;
+
+CREATE TABLE AppVote(
+	app INTEGER NOT NULL,
+	usr INTEGER NOT NULL,
+	PRIMARY KEY (app, usr),
+	FOREIGN KEY (app) REFERENCES MemberApp(id) ON DELETE CASCADE,
+	FOREIGN KEY (usr) REFERENCES WebUser(id) ON DELETE CASCADE);
+
