more robust sql scripts adding IF EXISTS to DROP TABLE statementes
[brisk.git] / sql / sql.d / 051-bin5-places.sql
1 --
2 -- try to start with a single table for all placings
3 --
4 -- tri = 0     lo = 0
5 -- mon = 2     hi = 1
6 -- wee = 4
7 --
8
9 DROP TABLE IF EXISTS #PFX#bin5_places_mtime;
10 CREATE TABLE #PFX#bin5_places_mtime (
11        code   int,
12        mtime  timestamp
13 );
14 INSERT INTO #PFX#bin5_places_mtime (code, mtime) VALUES (0, now());
15
16 DROP TABLE IF EXISTS #PFX#bin5_places;
17 CREATE TABLE #PFX#bin5_places (
18        type   integer,
19        rank   integer,
20        ucode  integer REFERENCES #PFX#users (code) ON DELETE cascade ON UPDATE cascade, 
21        login  text,
22        pts    integer,
23        games  integer,
24        score  float
25 );