changed column name

This commit is contained in:
2026-07-06 19:13:54 +05:00
parent 3ba5597a51
commit 08be61cbcd
33 changed files with 544 additions and 2129 deletions

View File

@@ -3,6 +3,5 @@ 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 provinces;
DROP TABLE IF EXISTS users;

View File

@@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS users (
"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,
"active" 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
);
@@ -26,36 +26,30 @@ insert into users(
CREATE TABLE IF NOT EXISTS provinces (
id bigserial PRIMARY KEY,
title json NOT NULL DEFAULT '{}'::json,
status boolean NOT NULL DEFAULT true,
name json NOT NULL DEFAULT '{}'::json,
region json NOT NULL DEFAULT '{}'::json,
active 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 location (
id bigserial PRIMARY KEY,
province_id bigint NOT NULL REFERENCES provinces(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 provinces(id) ON DELETE CASCADE,
location_id bigint NOT NULL REFERENCES location(id) ON DELETE CASCADE,
unikal_nomer character varying(250) NOT NULL UNIQUE,
"address" text NOT NULL DEFAULT '',
billing_username 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 '',
billing_password_visa character varying(250) NOT NULL DEFAULT '',
billing_username_swift character varying(250) NOT NULL DEFAULT '',
billing_password_swift character varying(250) NOT NULL DEFAULT '',
unique_code character varying(255) UNIQUE,
name json NOT NULL DEFAULT '{}'::json,
address json NOT NULL DEFAULT '{}'::json,
region character varying(2) NOT NULL DEFAULT '',
province_id bigint REFERENCES provinces(id) ON DELETE SET NULL,
phone_numbers json NOT NULL DEFAULT '[]'::json,
billing_username character varying(255) NOT NULL DEFAULT '',
billing_password character varying(255) NOT NULL DEFAULT '',
billing_swift_username character varying(255) NOT NULL DEFAULT '',
billing_swift_password character varying(255) NOT NULL DEFAULT '',
billing_visa_master_username character varying(255) NOT NULL DEFAULT '',
billing_visa_master_password character varying(255) NOT NULL DEFAULT '',
billing_sber_username character varying(255) NOT NULL DEFAULT '',
billing_sber_password character varying(255) NOT NULL DEFAULT '',
active 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
);
@@ -65,7 +59,7 @@ CREATE TABLE IF NOT EXISTS payment_cards (
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,
active 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
);
@@ -95,7 +89,7 @@ CREATE TABLE IF NOT EXISTS loan_required_documents (
content_en text NOT NULL DEFAULT '',
content_ru text NOT NULL DEFAULT '',
content_tm text NOT NULL DEFAULT '',
status boolean NOT NULL DEFAULT true,
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
);

View File

@@ -0,0 +1,4 @@
ALTER TABLE loan_required_documents 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;

View File

@@ -0,0 +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;