settings section
This commit is contained in:
8
db/migrations/20260702125108_init.down.sql
Normal file
8
db/migrations/20260702125108_init.down.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
DROP TABLE IF EXISTS loans_documents;
|
||||
DROP TABLE IF EXISTS loan_types;
|
||||
DROP TABLE IF EXISTS reasons_cards;
|
||||
DROP TABLE IF EXISTS payment_cards;
|
||||
DROP TABLE IF EXISTS branches;
|
||||
DROP TABLE IF EXISTS location;
|
||||
DROP TABLE IF EXISTS province;
|
||||
DROP TABLE IF EXISTS admin;
|
||||
98
db/migrations/20260702125108_init.up.sql
Normal file
98
db/migrations/20260702125108_init.up.sql
Normal file
@@ -0,0 +1,98 @@
|
||||
CREATE TABLE IF NOT EXISTS admin (
|
||||
"id" bigserial primary key,
|
||||
"login" character varying(250) NOT NULL DEFAULT '',
|
||||
"password" character varying(250) NOT NULL DEFAULT '',
|
||||
"fullname" character varying(250) NOT NULL DEFAULT '',
|
||||
"username" character varying(250) NOT NULL DEFAULT '',
|
||||
"phone_number" character varying(250) NOT NULL DEFAULT '',
|
||||
"avatar" character varying(250) NOT NULL DEFAULT '',
|
||||
"social_media" json NOT NULL DEFAULT '{}'::json,
|
||||
"light_mode" integer DEFAULT 1 NOT NULL,
|
||||
"role" character varying(250) NOT NULL DEFAULT 'user',
|
||||
"status" boolean NOT NULL DEFAULT true,
|
||||
"updated_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
"created_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||
);
|
||||
|
||||
insert into admin(
|
||||
phone_number, password, fullname, login, role
|
||||
) values (
|
||||
'61531216',
|
||||
'$2a$12$8ZbKmoSwna4CASQptM2/SubwvsBUR1YhABULd.2/QJB.13Wi2v55m',
|
||||
'Admin',
|
||||
'admin@admin.com',
|
||||
'admin'
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS province (
|
||||
id bigserial PRIMARY KEY,
|
||||
title json NOT NULL DEFAULT '{}'::json
|
||||
"updated_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
"created_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS location (
|
||||
id bigserial PRIMARY KEY,
|
||||
province_id bigint NOT NULL REFERENCES province(id) ON DELETE CASCADE,
|
||||
title json NOT NULL DEFAULT '{}'::json,
|
||||
status boolean NOT NULL DEFAULT true,
|
||||
"updated_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
"created_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS branches (
|
||||
id bigserial PRIMARY KEY,
|
||||
title json NOT NULL DEFAULT '{}'::json,
|
||||
province_id bigint NOT NULL REFERENCES province(id) ON DELETE CASCADE,
|
||||
location_id bigint NOT NULL REFERENCES location(id) ON DELETE CASCADE,
|
||||
unikal_nomer character varying(250) NOT NULL UNIQUE,
|
||||
address json NOT NULL DEFAULT '{}'::json,
|
||||
billing_login character varying(250) NOT NULL DEFAULT '',
|
||||
billing_password character varying(250) NOT NULL DEFAULT '',
|
||||
billing_username_sber character varying(250) NOT NULL DEFAULT '',
|
||||
billing_password_sber character varying(250) NOT NULL DEFAULT '',
|
||||
billing_username_visa character varying(250) NOT NULL DEFAULT '',
|
||||
"updated_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
"created_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS payment_cards (
|
||||
id bigserial PRIMARY KEY,
|
||||
price numeric(12, 2) NOT NULL DEFAULT 0,
|
||||
title json NOT NULL DEFAULT '{}'::json,
|
||||
content json NOT NULL DEFAULT '{}'::json,
|
||||
status boolean NOT NULL DEFAULT true,
|
||||
"updated_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
"created_at" TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS reasons_cards (
|
||||
id bigserial PRIMARY KEY,
|
||||
title json NOT NULL DEFAULT '{}'::json,
|
||||
price numeric(12, 2) NOT NULL DEFAULT 0,
|
||||
content json NOT NULL DEFAULT '{}'::json,
|
||||
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS loan_types (
|
||||
id bigserial PRIMARY KEY,
|
||||
title json NOT NULL DEFAULT '{}'::json,
|
||||
tax numeric(12, 2) NOT NULL DEFAULT 0,
|
||||
loan_term character varying(250) NOT NULL DEFAULT '',
|
||||
content json NOT NULL DEFAULT '{}'::json,
|
||||
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS loans_documents (
|
||||
id bigserial PRIMARY KEY,
|
||||
title json NOT NULL DEFAULT '{}'::json,
|
||||
content_en text NOT NULL DEFAULT '',
|
||||
content_ru text NOT NULL DEFAULT '',
|
||||
content_tm text NOT NULL DEFAULT '',
|
||||
status boolean NOT NULL DEFAULT true,
|
||||
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user