smart_ide/services/docv/docv-back/migrations/20260403160000_office_society_extensions.sql
Nicolas Cantu 01860b7af7 chore: remove gitmodules, add docv workspace crates, update systemd README
- Drop .gitmodules (ia_dev tracked as submodule pointer without file)
- Add services/docv Cargo workspace: docv-back, docv-shared, migrations, sources
- Refresh systemd/README.md
2026-04-03 17:55:50 +02:00

20 lines
932 B
SQL

-- Société (office) : hiérarchie, archivage ; dossier : prolonge le DP ; commentaires société (socle SPEC_18).
ALTER TABLE offices ADD COLUMN IF NOT EXISTS parent_office_uid UUID REFERENCES offices(uid) ON DELETE SET NULL;
ALTER TABLE offices ADD COLUMN IF NOT EXISTS archived_at TIMESTAMPTZ;
CREATE INDEX IF NOT EXISTS idx_offices_parent ON offices(parent_office_uid) WHERE parent_office_uid IS NOT NULL;
ALTER TABLE folders ADD COLUMN IF NOT EXISTS extends_permanent_record BOOLEAN NOT NULL DEFAULT false;
CREATE TABLE IF NOT EXISTS office_comments (
uid UUID PRIMARY KEY DEFAULT gen_random_uuid(),
office_uid UUID NOT NULL REFERENCES offices(uid) ON DELETE CASCADE,
user_uid UUID NOT NULL,
content TEXT NOT NULL,
access_level TEXT NOT NULL DEFAULT 'internal',
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_office_comments_office ON office_comments(office_uid);