Changeset 368:c9494920e8fa
- Timestamp:
- 05/02/2009 07:21:24 PM (3 years ago)
- Author:
- Dmitry Nezhevenko <dion@…>
- Branch:
- default
- Message:
-
Add foreign keys for postgresql
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r357
|
r368
|
|
| 16 | 16 | ); |
| 17 | 17 | |
| | 18 | DROP TABLE IF EXISTS conferences CASCADE; |
| | 19 | CREATE TABLE conferences ( |
| | 20 | name varchar(50) NOT NULL, |
| | 21 | id SERIAL, |
| | 22 | nick varchar(50) NOT NULL, |
| | 23 | created timestamp NOT NULL, |
| | 24 | autojoin boolean NOT NULL default true, |
| | 25 | online boolean NOT NULL default false, |
| | 26 | joined timestamp default NULL, |
| | 27 | autoleave boolean NOT NULL default true, |
| | 28 | owner varchar(200) NULL, |
| | 29 | PRIMARY KEY (name), |
| | 30 | UNIQUE (id) |
| | 31 | ); |
| | 32 | |
| 18 | 33 | DROP TABLE IF EXISTS conference_alists CASCADE; |
| 19 | 34 | CREATE TABLE conference_alists ( |
| … |
… |
|
| 29 | 44 | expire timestamp default NULL, |
| 30 | 45 | PRIMARY KEY (id), |
| | 46 | FOREIGN KEY(conference_id) REFERENCES conferences(id) ON DELETE CASCADE, |
| 31 | 47 | UNIQUE (conference_id,list,matcher,test,value, child_id) |
| 32 | 48 | ); |
| … |
… |
|
| 40 | 56 | temporary boolean NOT NULL default false, |
| 41 | 57 | created timestamp default NULL, |
| 42 | | PRIMARY KEY (id) |
| | 58 | PRIMARY KEY (id), |
| | 59 | FOREIGN KEY(conference_id) REFERENCES conferences(id) ON DELETE CASCADE |
| 43 | 60 | ); |
| 44 | 61 | |
| … |
… |
|
| 53 | 70 | joined timestamp NOT NULL, |
| 54 | 71 | lastaction timestamp NOT NULL, |
| 55 | | PRIMARY KEY (id) |
| 56 | | ); |
| 57 | | |
| 58 | | DROP TABLE IF EXISTS conferences CASCADE; |
| 59 | | CREATE TABLE conferences ( |
| 60 | | name varchar(50) NOT NULL, |
| 61 | | id SERIAL, |
| 62 | | nick varchar(50) NOT NULL, |
| 63 | | created timestamp NOT NULL, |
| 64 | | autojoin boolean NOT NULL default true, |
| 65 | | online boolean NOT NULL default false, |
| 66 | | joined timestamp default NULL, |
| 67 | | autoleave boolean NOT NULL default true, |
| 68 | | owner varchar(200) NULL, |
| 69 | | PRIMARY KEY (name), |
| 70 | | UNIQUE (id) |
| | 72 | PRIMARY KEY (id), |
| | 73 | FOREIGN KEY(conference_id) REFERENCES conferences(id) ON DELETE CASCADE, |
| | 74 | FOREIGN KEY(jid) REFERENCES conference_jids(id) ON DELETE CASCADE |
| 71 | 75 | ); |
| 72 | 76 | |