fix: CREATE audit table IF NOT EXISTS before ALTER in migration 042
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Failing after 39s
CI / test-python-backend-compliance (push) Successful in 37s
CI / test-python-document-crawler (push) Successful in 27s
CI / test-python-dsms-gateway (push) Successful in 22s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-09 23:54:20 +01:00
parent e7fab73a3a
commit 9f41ed4f8e

View File

@@ -59,7 +59,18 @@ BEGIN
END IF;
END $$;
-- 7. Add audit log project_id column too
-- 7. Create audit table if not exists, then add project_id
CREATE TABLE IF NOT EXISTS compliance_company_profile_audit (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id VARCHAR(255) NOT NULL,
action VARCHAR(20) NOT NULL,
changed_fields JSONB,
changed_by VARCHAR(255),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_company_profile_audit_tenant ON compliance_company_profile_audit(tenant_id);
ALTER TABLE compliance_company_profile_audit
ADD COLUMN IF NOT EXISTS project_id UUID;