· 7 years ago · Feb 20, 2019, 01:56 PM
1create database gio_test_db
2 with owner gio;
3
4create table if not exists customers
5(
6 id bigserial not null
7 constraint customers_pkey
8 primary key,
9 first_name varchar(50) not null,
10 last_name varchar(50) not null,
11 age integer,
12 personal_no varchar
13);
14
15alter table customers owner to gio;
16
17create table if not exists loans
18(
19 id bigserial not null
20 constraint loans_pk
21 primary key,
22 total_amount integer,
23 left_amount integer,
24 service_name varchar,
25 customer_id bigint
26);
27
28alter table loans owner to gio;
29
30create table if not exists contacts
31(
32 id bigserial not null
33 constraint contacts_pk
34 primary key,
35 customer_id bigint,
36 type_id integer,
37 value varchar
38);
39
40alter table contacts owner to gio;
41
42create unique index if not exists contacts_id_uindex
43 on contacts (id);
44
45create table if not exists properties
46(
47 id bigserial not null
48 constraint properties_pk
49 primary key,
50 customer_id bigint,
51 state varchar(100),
52 city varchar(100),
53 address varchar(100),
54 price integer,
55 type_id integer
56);
57
58alter table properties owner to gio;
59
60create unique index if not exists properties_id_uindex
61 on properties (id);