|
| 1 | +-- |
| 2 | +-- Generated by Maven: mvn -P test hibernate3:hbm2ddl |
| 3 | +-- |
| 4 | + |
| 5 | + create table suspicious_activities ( |
| 6 | + id integer generated by default as identity (start with 1), |
| 7 | + ip varchar(15) not null, |
| 8 | + occured_at timestamp not null, |
| 9 | + page varchar(100) not null, |
| 10 | + referer_page varchar(255) not null, |
| 11 | + user_agent varchar(255) not null, |
| 12 | + type_id integer not null, |
| 13 | + user_id integer, |
| 14 | + primary key (id) |
| 15 | + ); |
| 16 | + |
| 17 | + create table suspicious_activities_types ( |
| 18 | + id integer generated by default as identity (start with 1), |
| 19 | + name varchar(100) not null, |
| 20 | + primary key (id), |
| 21 | + unique (name) |
| 22 | + ); |
| 23 | + |
| 24 | + create table users ( |
| 25 | + id integer generated by default as identity (start with 1), |
| 26 | + activated_at timestamp not null, |
| 27 | + email varchar(255) not null, |
| 28 | + hash varchar(40) not null, |
| 29 | + login varchar(15) not null, |
| 30 | + name varchar(100) not null, |
| 31 | + registered_at timestamp not null, |
| 32 | + salt varchar(10) not null, |
| 33 | + primary key (id), |
| 34 | + unique (login) |
| 35 | + ); |
| 36 | + |
| 37 | + create table users_activation ( |
| 38 | + act_key varchar(10) not null, |
| 39 | + created_at timestamp not null, |
| 40 | + email varchar(255) not null, |
| 41 | + primary key (act_key) |
| 42 | + ); |
| 43 | + |
| 44 | + alter table suspicious_activities |
| 45 | + add constraint FK35F0CA0F8D3FBEA4 |
| 46 | + foreign key (user_id) |
| 47 | + references users; |
| 48 | + |
| 49 | + alter table suspicious_activities |
| 50 | + add constraint FK35F0CA0FC005E970 |
| 51 | + foreign key (type_id) |
| 52 | + references suspicious_activities_types; |
0 commit comments