diff options
Diffstat (limited to 'db_demo/sql/tables')
-rw-r--r-- | db_demo/sql/tables/cr_tbl_person.sql | 7 | ||||
-rw-r--r-- | db_demo/sql/tables/cr_tbl_test.sql | 5 | ||||
-rw-r--r-- | db_demo/sql/tables/cr_tbl_turn.sql | 12 |
3 files changed, 14 insertions, 10 deletions
diff --git a/db_demo/sql/tables/cr_tbl_person.sql b/db_demo/sql/tables/cr_tbl_person.sql index 95e01b7..87fc5bd 100644 --- a/db_demo/sql/tables/cr_tbl_person.sql +++ b/db_demo/sql/tables/cr_tbl_person.sql @@ -1,8 +1,9 @@ CREATE SEQUENCE seq_person START 1;
CREATE TABLE tbl_person (
- key integer PRIMARY KEY, -- primary key
+ key integer DEFAULT nextval('seq_person') PRIMARY KEY, -- primary key
agegroupid integer NOT NULL REFERENCES const_agegroup(key), -- age group foreign key
- c_experience boolean NOT NULL, -- computer experience
- w_experience boolean NOT NULL -- wiimote experience
+ cexperience boolean NOT NULL, -- computer experience
+ wexperience boolean NOT NULL, -- wiimote experience
+ inserttime timestamp DEFAULT current_timestamp -- time of insertion
);
\ No newline at end of file diff --git a/db_demo/sql/tables/cr_tbl_test.sql b/db_demo/sql/tables/cr_tbl_test.sql index 15e94d0..63b861b 100644 --- a/db_demo/sql/tables/cr_tbl_test.sql +++ b/db_demo/sql/tables/cr_tbl_test.sql @@ -1,7 +1,8 @@ CREATE SEQUENCE seq_test START 1;
CREATE TABLE tbl_test (
- key integer PRIMARY KEY, -- primary key
+ key integer DEFAULT nextval('seq_test') PRIMARY KEY, -- primary key
personid integer NOT NULL REFERENCES tbl_person(key), -- person foreign key
- gametypeid integer NOT NULL REFERENCES const_gametype(key) -- gametype foreign key
+ gametypeid integer NOT NULL REFERENCES const_gametype(key), -- gametype foreign key
+ inserttime timestamp DEFAULT current_timestamp -- time of insertion
);
\ No newline at end of file diff --git a/db_demo/sql/tables/cr_tbl_turn.sql b/db_demo/sql/tables/cr_tbl_turn.sql index f0b7cc3..10218e2 100644 --- a/db_demo/sql/tables/cr_tbl_turn.sql +++ b/db_demo/sql/tables/cr_tbl_turn.sql @@ -1,9 +1,11 @@ CREATE SEQUENCE seq_turn START 1;
CREATE TABLE tbl_turn (
- key integer 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
+ 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)
);
\ No newline at end of file |