feat(phase-0,phase-2): bootstrap DB schemas + Metabase/NocoDB compose + work_types seed

This commit is contained in:
Roman Chesnokov
2026-05-14 15:26:59 +05:00
parent 7b282af5be
commit ba2059ae15
13 changed files with 398 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
-- 003_core_project.sql — core.project + core.stage
CREATE TABLE core.project (
id bigserial PRIMARY KEY,
name text NOT NULL,
bitra_id text UNIQUE,
eva_id text UNIQUE,
bitra_code text,
eva_code text,
is_sd boolean DEFAULT false, -- SD-проект (из явного списка)
status text,
cache_status_type text, -- из EVA: OPEN/IN_PROGRESS/IN_REVIEW/CLOSED
project_manager_id bigint REFERENCES core.employee,
bitrix_company_id bigint,
bitra_client_id text,
bitra_client_name text, -- для отображения
deadline date,
budget decimal(15,2),
last_synced timestamptz
);
CREATE INDEX idx_project_bitra ON core.project (bitra_id);
CREATE INDEX idx_project_eva ON core.project (eva_id);
CREATE INDEX idx_project_sd ON core.project (is_sd) WHERE is_sd = true;
CREATE TABLE core.stage (
id bigserial PRIMARY KEY,
name text NOT NULL,
bitra_id text UNIQUE,
project_id bigint REFERENCES core.project,
plan_start_date date,
plan_end_date date,
is_completed boolean DEFAULT false,
is_acted boolean DEFAULT false
);
CREATE INDEX idx_stage_project ON core.stage (project_id);