3d-interface/sql/backup.pgsql

75 lines
1.6 KiB
Plaintext
Raw Normal View History

2015-05-18 15:33:14 +02:00
DROP TABLE IF EXISTS users CASCADE;
DROP TABLE IF EXISTS arrowclicked CASCADE;
2015-05-19 11:03:53 +02:00
DROP TABLE IF EXISTS coinclicked CASCADE;
2015-05-19 11:50:12 +02:00
DROP TABLE IF EXISTS keyboardevent CASCADE;
2015-05-20 15:20:59 +02:00
DROP TABLE IF EXISTS resetclicked CASCADE;
DROP TABLE IF EXISTS previousnextclicked CASCADE;
2015-05-21 15:35:40 +02:00
DROP TABLE IF EXISTS hovered CASCADE;
2015-05-18 09:52:04 +02:00
2015-05-19 11:50:12 +02:00
DROP TYPE IF EXISTS VECTOR3 CASCADE;
DROP TYPE IF EXISTS CAMERA CASCADE;
DROP TYPE IF EXISTS PREVIOUSNEXT CASCADE;
CREATE TYPE PREVIOUSNEXT AS ENUM(
'p', 'n'
);
2015-05-19 11:50:12 +02:00
CREATE TYPE VECTOR3 AS(
x FLOAT,
y FLOAT,
z FLOAT
);
CREATE TYPE CAMERA AS(
position VECTOR3,
target VECTOR3
);
CREATE TABLE users(
2015-05-18 09:52:04 +02:00
id SERIAL PRIMARY KEY,
2015-05-19 11:50:12 +02:00
name CHAR(50)
2015-05-18 09:52:04 +02:00
);
2015-05-18 15:33:14 +02:00
CREATE TABLE arrowclicked(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES users (id),
time TIMESTAMP DEFAULT NOW(),
arrow_id INTEGER
);
2015-05-19 11:03:53 +02:00
CREATE TABLE coinclicked(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES users (id),
time TIMESTAMP DEFAULT NOW(),
coin_id INTEGER
);
2015-05-19 11:50:12 +02:00
CREATE TABLE keyboardevent(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES users (id),
time TIMESTAMP DEFAULT NOW(),
camera CAMERA
);
2015-05-20 15:20:59 +02:00
CREATE TABLE resetclicked(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES users (id),
time TIMESTAMP DEFAULT NOW()
);
CREATE TABLE previousnextclicked(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES users (id),
previousnext PREVIOUSNEXT NOT NULL,
time TIMESTAMP DEFAULT NOW(),
camera CAMERA
);
2015-05-21 15:35:40 +02:00
CREATE TABLE hovered(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES users (id),
start BOOLEAN NOT NULL,
time TIMESTAMP DEFAULT NOW(),
arrow_id INT
);