summaryrefslogtreecommitdiffstats
path: root/db_demo/sql/tables/cr_tbl_turn.sql
blob: 10218e2fb2c0cd963f88ded8725408c786ec6a52 (plain)
1
2
3
4
5
6
7
8
9
10
11
CREATE SEQUENCE seq_turn START 1;

CREATE TABLE tbl_turn (
  key            integer DEFAULT nextval('seq_turn') PRIMARY KEY,   -- primary key
  testid         integer NOT NULL REFERENCES tbl_test(key),         -- test foreign key
  blockid        integer NOT NULL REFERENCES const_block(key),      -- block foreign key
  elapsedtime    time NOT NULL,                                     -- time in ms.
  holeposition   integer NOT NULL,                                  -- position of the hole
  inserttime     timestamp DEFAULT current_timestamp                -- time of insertion
  CONSTRAINT     valid_hole CHECK (holeposition >= 0 AND holeposition < 16)
);