· 10 years ago · Sep 23, 2016, 09:22 AM
1drop table if exists bol_hotel;
2
3create table bol_hotel (
4 code int primary key
5 ,name text
6 ,categoryCode varchar(5)
7 ,categoryName varchar(12)
8 ,destinationCode varchar(3)
9 ,destinationName varchar(255)
10 ,zoneCode int
11 ,zoneName text
12 ,latitude float
13 ,longitude float
14 ,minRate float
15 ,maxRate float
16 ,currency varchar(3)
17);
18
19drop table if exists bol_room;
20
21create table bol_room (
22 code varchar(12) primary key
23 ,name varchar(127)
24);
25
26drop table if exists bol_rate cascade;
27
28create table bol_rate (
29 rateId serial primary key not null
30 ,rateKey text
31 ,rateClass varchar(5)
32 ,rateType varchar(16)
33 ,net float
34 ,allotment int
35 ,rateCommentsId text
36 ,paymentType varchar(12)
37 ,boardCode varchar(4)
38 ,boardName varchar(64)
39 ,rooms int
40 ,adults int
41 ,children int
42 ,agentRate float
43);
44
45drop table if exists bol_room_rates;
46
47create table bol_room_rates (
48 hotelCode int
49 ,roomCode varchar(12)
50 ,rateId int
51);
52
53alter table bol_room_rates
54add constraint rateId_fk foreign key (rateId) references bol_rate;
55alter table bol_room_rates
56add constraint roomCode_fk foreign key (roomCode) references bol_room (code);
57alter table bol_room_rates
58add constraint hotelCode_fk foreign key (rateId) references bol_rate (rateId);