Cleaning and coin events

This commit is contained in:
Thomas FORGIONE
2015-05-19 11:03:53 +02:00
parent d6e8686b3f
commit ee3bf01ab0
12 changed files with 124 additions and 49 deletions

4
sql/all_elements.pgsql Normal file
View File

@@ -0,0 +1,4 @@
SELECT user_id, arrow_id as elt_id, time, 'arrow' as elt FROM arrowclicked
UNION
SELECT user_id, coin_id, time, 'coin' FROM coinclicked
ORDER BY time;

View File

@@ -1,5 +1,6 @@
DROP TABLE IF EXISTS users CASCADE;
DROP TABLE IF EXISTS arrowclicked CASCADE;
DROP TABLE IF EXISTS coinclicked CASCADE;
CREATE TABLE users (
id SERIAL PRIMARY KEY,
@@ -13,3 +14,9 @@ CREATE TABLE arrowclicked(
arrow_id INTEGER
);
CREATE TABLE coinclicked(
id SERIAL PRIMARY KEY,
user_id SERIAL REFERENCES users (id),
time TIMESTAMP DEFAULT NOW(),
coin_id INTEGER
);