author | Michael Krelin <hacker@klever.net> | 2013-11-22 17:05:41 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2013-11-24 20:03:19 (UTC) |
commit | bcfe3d4f277b5d87e5c3fd56479e07f194a37144 (patch) (side-by-side diff) | |
tree | f2cdd9f27c59e4a17727d9fb353d55e04aed97da /backend/node/src/clipperz.schema.sql | |
parent | 1180b7b195157aaeb4f0d5380e0c886bbd06c2e2 (diff) | |
download | clipperz-bcfe3d4f277b5d87e5c3fd56479e07f194a37144.zip clipperz-bcfe3d4f277b5d87e5c3fd56479e07f194a37144.tar.gz clipperz-bcfe3d4f277b5d87e5c3fd56479e07f194a37144.tar.bz2 |
nodejs+postgresql backend
Diffstat (limited to 'backend/node/src/clipperz.schema.sql') (more/less context) (ignore whitespace changes)
-rw-r--r-- | backend/node/src/clipperz.schema.sql | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/backend/node/src/clipperz.schema.sql b/backend/node/src/clipperz.schema.sql new file mode 100644 index 0000000..ba6f482 --- a/dev/null +++ b/backend/node/src/clipperz.schema.sql @@ -0,0 +1,60 @@ +CREATE SCHEMA clipperz; + +CREATE TABLE clipperz.theuser ( + u_id serial PRIMARY KEY, + u_name varchar NOT NULL UNIQUE, + u_srp_s varchar NOT NULL, + u_srp_v varchar NOT NULL, + u_header json NOT NULL, + u_statistics varchar NOT NULL, + u_authversion varchar NOT NULL, + u_version varchar NOT NULL, + u_lock varchar NOT NULL +); + +CREATE TABLE clipperz.therecord ( + r_id serial PRIMARY KEY, + u_id integer NOT NULL REFERENCES clipperz.theuser(u_id) ON UPDATE CASCADE ON DELETE CASCADE, + r_ref varchar NOT NULL UNIQUE, + r_data varchar NOT NULL, + r_version varchar NOT NULL, + r_ctime timestamp NOT NULL DEFAULT current_timestamp, + r_mtime timestamp NOT NULL DEFAULT current_timestamp, + r_atime timestamp NOT NULL DEFAULT current_timestamp +); +CREATE INDEX therecord_u_id_key ON clipperz.therecord (u_id); + +CREATE TABLE clipperz.therecordversion ( + rv_id serial PRIMARY KEY, + r_id integer NOT NULL REFERENCES clipperz.therecord (r_id) ON UPDATE CASCADE ON DELETE CASCADE, + rv_ref varchar NOT NULL UNIQUE, + rv_header varchar, + rv_data varchar NOT NULL, + rv_version varchar NOT NULL, + rv_previous_key varchar NOT NULL, + rv_previous_id varchar, + rv_ctime timestamp NOT NULL DEFAULT current_timestamp, + rv_mtime timestamp NOT NULL DEFAULT current_timestamp, + rv_atime timestamp NOT NULL DEFAULT current_timestamp +); + +CREATE TABLE clipperz.otpstatus ( + otps_id serial PRIMARY KEY, + otps_code varchar NOT NULL, + otps_name varchar NOT NULL, + otps_desc varchar NOT NULL +); + +CREATE TABLE clipperz.theotp ( + otp_id serial PRIMARY KEY, + u_id integer REFERENCES clipperz.theuser (u_id) ON UPDATE CASCADE ON DELETE CASCADE, + otps_id integer REFERENCES clipperz.otpstatus (otps_id) ON UPDATE CASCADE ON DELETE CASCADE, + otp_ref varchar NOT NULL UNIQUE, + otp_key varchar NOT NULL UNIQUE, + otp_key_checksum varchar NOT NULL, + otp_data varchar NOT NULL, + otp_version varchar NOT NULL, + otp_ctime timestamp NOT NULL DEFAULT current_timestamp, + otp_rtime timestamp NOT NULL DEFAULT current_timestamp, + otp_utime timestamp NOT NULL DEFAULT current_timestamp +); |