-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tables.sql
62 lines (58 loc) · 2.15 KB
/
Tables.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- Author : Tushar Gaonkar (https://github.com/TusharGaonkar)
-- Rooms Table Schema
create table if not exists
public.rooms (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
name text not null,
"maxCapacity" smallint not null,
"regularPrice" numeric not null,
discount numeric null,
description text null,
image text null,
constraint rooms_pkey primary key (id)
) tablespace pg_default;
-- Guests Table Schema
create table if not exists
public.guests (
id bigint primary key generated always as identity,
created_at timestamp with time zone not null default now(),
"fullName" text not null,
email text null,
nationality text not null,
"nationalID" text not null,
"countryFlag" text null
) tablespace pg_default;
-- Bookings Table Schema
create table if not exists
public.bookings (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
"startDate" timestamp without time zone not null,
"endDate" timestamp without time zone not null,
"numNights" smallint null,
"numGuests" smallint null,
"roomPrice" numeric not null,
"extrasPrice" numeric null,
"totalPrice" numeric not null,
status text not null,
"hasBreakfast" boolean null,
"isPaid" boolean not null default false,
observations text null,
"roomID" bigint not null,
"guestID" bigint not null,
constraint bookings_pkey primary key (id),
constraint bookings_guestID_fkey foreign key ("guestID") references guests (id),
constraint bookings_roomID_fkey foreign key ("roomID") references rooms (id)
) tablespace pg_default;
-- Settings Table Schema
create table if not exists
public.settings (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
"minBookingLength" smallint not null default 1,
"maxBookingLength" smallint not null default 10,
"maxGuestsPerBooking" smallint not null default 3,
"breakfastPrice" numeric not null default 0,
constraint settings_pkey primary key (id)
) tablespace pg_default;