2015-10-20 16:30:52 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
psql interface 3dinterface << E_O_SQL
|
|
|
|
|
2015-06-04 16:52:58 +02:00
|
|
|
-- Clear database from previous tables (just in case...)
|
2015-07-09 15:38:56 +02:00
|
|
|
DROP TABLE IF EXISTS Users CASCADE;
|
|
|
|
DROP TABLE IF EXISTS Arrowclicked CASCADE;
|
|
|
|
DROP TABLE IF EXISTS CoinClicked CASCADE;
|
|
|
|
DROP TABLE IF EXISTS KeyboardEvent CASCADE;
|
|
|
|
DROP TABLE IF EXISTS ResetClicked CASCADE;
|
|
|
|
DROP TABLE IF EXISTS PreviousNextClicked CASCADE;
|
|
|
|
DROP TABLE IF EXISTS Hovered CASCADE;
|
|
|
|
DROP TABLE IF EXISTS Scene CASCADE;
|
|
|
|
DROP TABLE IF EXISTS Experiment CASCADE;
|
|
|
|
DROP TABLE IF EXISTS FpsCounter CASCADE;
|
|
|
|
DROP TABLE IF EXISTS PointerLocked CASCADE;
|
|
|
|
DROP TABLE IF EXISTS SwitchedLockOption CASCADE;
|
2015-07-20 14:41:59 +02:00
|
|
|
DROP TABLE IF EXISTS Coin CASCADE;
|
2015-08-03 00:00:07 +02:00
|
|
|
DROP TABLE IF EXISTS CoinCombination CASCADE;
|
2015-08-04 18:59:24 +02:00
|
|
|
DROP TABLE IF EXISTS RecommendationStyle 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;
|
2015-05-20 16:28:53 +02:00
|
|
|
DROP TYPE IF EXISTS PREVIOUSNEXT CASCADE;
|
|
|
|
|
2015-06-04 16:52:58 +02:00
|
|
|
-- Elementary types
|
2015-05-20 16:28:53 +02:00
|
|
|
CREATE TYPE PREVIOUSNEXT AS ENUM(
|
|
|
|
'p', 'n'
|
|
|
|
);
|
2015-05-19 11:50:12 +02:00
|
|
|
|
|
|
|
CREATE TYPE VECTOR3 AS(
|
2015-05-22 16:59:33 +02:00
|
|
|
x REAL,
|
|
|
|
y REAL,
|
|
|
|
z REAL
|
2015-05-19 11:50:12 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TYPE CAMERA AS(
|
|
|
|
position VECTOR3,
|
|
|
|
target VECTOR3
|
|
|
|
);
|
|
|
|
|
2015-06-04 16:52:58 +02:00
|
|
|
-- Base tables
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE Users(
|
2015-05-18 09:52:04 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-27 16:59:53 +02:00
|
|
|
worker_id VARCHAR(50),
|
|
|
|
age VARCHAR(10),
|
|
|
|
rating INT,
|
|
|
|
lasttime INT,
|
2015-10-05 09:50:04 +02:00
|
|
|
male BOOLEAN,
|
|
|
|
valid BOOLEAN DEFAULT NULL
|
2015-05-18 09:52:04 +02:00
|
|
|
);
|
2015-05-18 15:33:14 +02:00
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE Scene(
|
2015-08-04 18:59:24 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name CHAR(50),
|
|
|
|
coin_number INTEGER
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE RecommendationStyle(
|
2015-06-04 16:52:58 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name CHAR(50)
|
|
|
|
);
|
|
|
|
|
2015-08-03 00:00:07 +02:00
|
|
|
CREATE TABLE CoinCombination(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
scene_id SERIAL REFERENCES Scene (id),
|
|
|
|
coin_1 INTEGER,
|
|
|
|
coin_2 INTEGER,
|
|
|
|
coin_3 INTEGER,
|
|
|
|
coin_4 INTEGER,
|
|
|
|
coin_5 INTEGER,
|
|
|
|
coin_6 INTEGER,
|
|
|
|
coin_7 INTEGER,
|
|
|
|
coin_8 INTEGER
|
|
|
|
);
|
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE Experiment(
|
2015-05-18 15:33:14 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
user_id SERIAL REFERENCES Users (id),
|
2015-08-03 00:00:07 +02:00
|
|
|
coin_combination_id SERIAL REFERENCES CoinCombination (id),
|
2015-10-01 16:25:02 +02:00
|
|
|
recommendation_style VARCHAR(30),
|
|
|
|
finished BOOLEAN DEFAULT(false)
|
2015-06-04 16:52:58 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
-- Init scene table
|
2015-08-04 18:59:24 +02:00
|
|
|
INSERT INTO Scene(name, coin_number) VALUES ('peachcastle' , 41);
|
|
|
|
INSERT INTO Scene(name, coin_number) VALUES ('bobomb' , 44);
|
2015-09-02 09:41:43 +02:00
|
|
|
INSERT INTO Scene(name, coin_number) VALUES ('coolcoolmountain', 66);
|
2015-08-04 18:59:24 +02:00
|
|
|
INSERT INTO Scene(name, coin_number) VALUES ('whomp' , 50);
|
|
|
|
|
2015-10-01 17:36:19 +02:00
|
|
|
INSERT INTO RecommendationStyle(name) VALUES('L3D.BaseRecommendation');
|
2015-08-04 18:59:24 +02:00
|
|
|
INSERT INTO RecommendationStyle(name) VALUES('L3D.ArrowRecommendation');
|
|
|
|
INSERT INTO RecommendationStyle(name) VALUES('L3D.ViewportRecommendation');
|
2015-06-04 16:52:58 +02:00
|
|
|
|
|
|
|
-- Events
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE ArrowClicked(
|
2015-06-04 16:52:58 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-05-18 15:33:14 +02:00
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
|
|
|
arrow_id INTEGER
|
|
|
|
);
|
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE CoinClicked(
|
2015-05-19 11:03:53 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-05-19 11:03:53 +02:00
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
|
|
|
coin_id INTEGER
|
|
|
|
);
|
2015-05-19 11:50:12 +02:00
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE KeyboardEvent(
|
2015-05-19 11:50:12 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-05-19 11:50:12 +02:00
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
2015-08-04 18:59:24 +02:00
|
|
|
keycode INTEGER,
|
|
|
|
keypressed BOOLEAN,
|
2015-05-19 11:50:12 +02:00
|
|
|
camera CAMERA
|
|
|
|
);
|
2015-05-20 15:20:59 +02:00
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE ResetClicked(
|
2015-05-20 15:20:59 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-05-20 15:20:59 +02:00
|
|
|
time TIMESTAMP DEFAULT NOW()
|
|
|
|
);
|
2015-05-20 16:28:53 +02:00
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE PreviousNextClicked(
|
2015-05-20 16:28:53 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-05-20 16:28:53 +02:00
|
|
|
previousnext PREVIOUSNEXT NOT NULL,
|
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
|
|
|
camera CAMERA
|
|
|
|
);
|
2015-05-21 15:35:40 +02:00
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE Hovered(
|
2015-05-21 15:35:40 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-05-21 15:35:40 +02:00
|
|
|
start BOOLEAN NOT NULL,
|
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
2015-06-04 16:52:58 +02:00
|
|
|
arrow_id INTEGER
|
2015-05-21 15:35:40 +02:00
|
|
|
);
|
2015-06-22 09:41:59 +02:00
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE FpsCounter(
|
2015-06-22 09:41:59 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-07-09 15:38:56 +02:00
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
2015-06-22 09:41:59 +02:00
|
|
|
fps REAL
|
|
|
|
);
|
2015-07-09 15:38:56 +02:00
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE PointerLocked(
|
2015-07-09 15:38:56 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-07-09 15:38:56 +02:00
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
|
|
|
locked BOOLEAN
|
|
|
|
);
|
|
|
|
|
2015-07-20 14:41:59 +02:00
|
|
|
CREATE TABLE SwitchedLockOption(
|
2015-07-09 15:38:56 +02:00
|
|
|
id SERIAL PRIMARY KEY,
|
2015-07-20 14:41:59 +02:00
|
|
|
exp_id SERIAL REFERENCES Experiment (id),
|
2015-07-09 15:38:56 +02:00
|
|
|
time TIMESTAMP DEFAULT NOW(),
|
|
|
|
locked BOOLEAN
|
|
|
|
);
|
2015-10-20 16:30:52 +02:00
|
|
|
|
|
|
|
E_O_SQL
|