more robust sql scripts adding IF EXISTS to DROP TABLE statementes
[brisk.git] / sql / sql.d / 001-struct.sql
1 -- TODO
2 --   DONE - CASCADE ON DELETE of orders related tables
3 --   DONE - STATUS on orders
4
5 DROP TABLE IF EXISTS #PFX#users;
6 CREATE TABLE #PFX#users (
7        code   SERIAL PRIMARY KEY,
8        login  text UNIQUE,
9        pass   text,
10        email  text UNIQUE,
11        type   integer,
12        tsusp  timestamp DEFAULT to_timestamp(0), -- disable timeout
13        mtime  timestamp DEFAULT to_timestamp(0)  -- last access
14        );
15
16 DROP TABLE IF EXISTS #PFX#groups;
17 CREATE TABLE #PFX#groups (
18        code   SERIAL PRIMARY KEY,
19        name   text
20        );
21
22