76 lines
2.2 KiB
SQL
76 lines
2.2 KiB
SQL
CREATE DATABASE salaryloan;
|
|
CREATE user salaryloan with encrypted password 'salaryloan';
|
|
GRANT all privileges on database salaryloan to salaryloan;
|
|
|
|
CREATE TABLE demo_bank_accounts (
|
|
id SERIAL,
|
|
uid uuid DEFAULT uuid_generate_v4(),
|
|
name VARCHAR(125),
|
|
offers INT DEFAULT 0,
|
|
salary_account INT DEFAULT 0,
|
|
current_loans INT DEFAULT 0,
|
|
mobile VARCHAR(25) UNIQUE NOT NULL,
|
|
bvn VARCHAR(12) UNIQUE NOT NULL,
|
|
email VARCHAR(125),
|
|
pin VARCHAR(6),
|
|
added timestamp without time zone DEFAULT now()
|
|
);
|
|
ALTER TABLE ONLY demo_bank_accounts
|
|
ADD CONSTRAINT demo_bank_accounts_id_key UNIQUE (id);
|
|
|
|
|
|
|
|
CREATE TABLE loan_offers (
|
|
id SERIAL,
|
|
uid uuid DEFAULT uuid_generate_v4(),
|
|
loan VARCHAR(25) UNIQUE NOT NULL,
|
|
amount INT DEFAULT 0,
|
|
description VARCHAR(125),
|
|
days_duration INT DEFAULT 0,
|
|
active INT DEFAULT 1,
|
|
lorder INT DEFAULT 0,
|
|
score INT DEFAULT 0,
|
|
added timestamp without time zone DEFAULT now()
|
|
);
|
|
ALTER TABLE ONLY loan_offers
|
|
ADD CONSTRAINT loan_offers_id_key UNIQUE (id);
|
|
|
|
INSERT INTO loan_offers (
|
|
loan, amount, description, days_duration
|
|
) VALUES (
|
|
'LOAN001',
|
|
100000,
|
|
'100,000 Naira for 30 Days',
|
|
30
|
|
);
|
|
|
|
INSERT INTO loan_offers (
|
|
loan, amount, description, days_duration
|
|
) VALUES (
|
|
'LOAN002',
|
|
300000,
|
|
'300,000 Naira for 60 Days',
|
|
60
|
|
);
|
|
|
|
|
|
INSERT INTO loan_offers (
|
|
loan, amount, description, days_duration
|
|
) VALUES (
|
|
'LOAN003',
|
|
900000,
|
|
'900,000 Naira for 90 Days',
|
|
90
|
|
);
|
|
|
|
|
|
|
|
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce00", "description": "100,000 Naira for 30 Days" , "active" : 1 },
|
|
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce01", "description": "300,000 Naira for 60 Days" , "active" : 1 },
|
|
{"cid": "425611f2-c692-4404-b93d-76ca7a5ce02", "description": "900,000 Naira for 90 Days" , "active" : 1 },
|
|
]
|
|
|
|
|
|
{"cid": "1", "description": "Product Loan 01" , "active" : 0 },
|
|
{"cid": "2", "description": "Product Loan 02" , "active" : 0 },
|
|
{"cid": "3", "description": "First Advance" , "active" : 1 }, |