Align loan type and required document schema with updated column names.

Rename loan_required_documents to loan_order_required_docs, simplify document fields to name/value, and map loan_types columns to name, maturity, notes, and active.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
guwandykandCursor committed 2026-07-06 22:48:19 +05:00
1 parent 08be61cbcd
commit ef56625321
9 files changed
+66 -89

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
DROP TABLE IF EXISTS loan_required_documents;
DROP TABLE IF EXISTS loan_order_required_docs;
DROP TABLE IF EXISTS loan_types;
DROP TABLE IF EXISTS reasons_cards;
DROP TABLE IF EXISTS payment_cards;
+12 -13
View File
@@ -75,20 +75,19 @@ CREATE TABLE IF NOT EXISTS reasons_cards (
CREATE TABLE IF NOT EXISTS loan_types (
id bigserial PRIMARY KEY,
title json NOT NULL DEFAULT '{}'::json,
name 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 loan_required_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 '',
maturity character varying(250) NOT NULL DEFAULT '',
notes json NOT NULL DEFAULT '{}'::json,
active 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
);
CREATE TABLE IF NOT EXISTS loan_order_required_docs (
id bigserial PRIMARY KEY,
name text NOT NULL DEFAULT '',
value text NOT NULL DEFAULT '',
active 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
@@ -1,4 +1,4 @@
ALTER TABLE loan_required_documents RENAME COLUMN active TO status;
ALTER TABLE loan_order_required_docs RENAME COLUMN active TO status;
ALTER TABLE payment_cards RENAME COLUMN active TO status;
ALTER TABLE provinces RENAME COLUMN active TO status;
ALTER TABLE users RENAME COLUMN active TO status;
@@ -1,4 +1,4 @@
ALTER TABLE users RENAME COLUMN status TO active;
ALTER TABLE provinces RENAME COLUMN status TO active;
ALTER TABLE payment_cards RENAME COLUMN status TO active;
ALTER TABLE loan_required_documents RENAME COLUMN status TO active;
ALTER TABLE loan_order_required_docs RENAME COLUMN status TO active;