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
+19
View File
@@ -0,0 +1,19 @@
-- 007_core_identity_map.sql — таблица соответствий ID между системами
CREATE TABLE core.identity_map (
id bigserial PRIMARY KEY,
entity_type text NOT NULL CHECK (entity_type IN ('employee','project','client')),
core_id bigint,
bitra_id text,
eva_id text,
bitrix_id bigint,
confidence text NOT NULL CHECK (confidence IN ('auto','confirmed','manual')),
match_key text,
confirmed_by text,
confirmed_at timestamptz,
created_at timestamptz DEFAULT now(),
UNIQUE (entity_type, bitra_id, eva_id, bitrix_id)
);
CREATE INDEX idx_identity_map_core ON core.identity_map (entity_type, core_id);
CREATE INDEX idx_identity_map_confidence ON core.identity_map (confidence) WHERE confidence = 'manual';