changed arhitecture

This commit is contained in:
2026-07-15 18:08:19 +05:00
parent 7e3a5cebcc
commit 585ba63bc2
95 changed files with 4985 additions and 1360 deletions

View File

@@ -7,6 +7,22 @@ CREATE TABLE IF NOT EXISTS roles (
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
);
CREATE TABLE IF NOT EXISTS role_user (
id bigserial PRIMARY KEY,
role_id bigint REFERENCES roles(id),
user_id bigint REFERENCES users(id),
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 permission_user (
id bigserial PRIMARY KEY,
permission_id bigint REFERENCES permissions(id),
user_id bigint REFERENCES users(id),
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 users (
"id" bigserial primary key,
"email" character varying(250) NOT NULL DEFAULT '',
@@ -49,9 +65,9 @@ CREATE TABLE IF NOT EXISTS branches (
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 '',
region character varying(20) NOT NULL DEFAULT '',
province_id bigint,
phone_numbers json NOT NULL DEFAULT '[]'::json,
phone_numbers character varying(255) NOT NULL DEFAULT '',
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 '',
@@ -326,4 +342,5 @@ CREATE TABLE IF NOT EXISTS cards (
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
CONSTRAINT cards_user_id_fkey
FOREIGN KEY ("user_id") REFERENCES users(id)
);
);