bmc_hub/migrations/1059_case_email_template_assets.sql
Christian 4871dd2d9e Add comprehensive test coverage for various modules
- Introduced tests for mail templates including ranking, rendering, and attachment handling.
- Added tests for time billing selection and approval processes, ensuring proper validation and state management.
- Implemented tests for case types in JavaScript, focusing on loading and editing functionality.
- Created tests for contact mail AI integration, ensuring proper parsing and error handling.
- Developed tests for dark theme CSS contrast and loading order.
- Added tests for invoice fee service, covering various scenarios including exemptions and invalid inputs.
- Implemented vendor resource tests, ensuring proper file handling and query validation.
2026-10-08 08:58:02 +02:00

15 lines
823 B
SQL

-- Additive: keep the existing template catalog and all existing mail behavior.
ALTER TABLE email_templates ADD COLUMN IF NOT EXISTS match_tags JSONB NOT NULL DEFAULT '[]'::jsonb;
ALTER TABLE email_templates ADD COLUMN IF NOT EXISTS case_request_id UUID;
CREATE UNIQUE INDEX IF NOT EXISTS email_templates_case_request_idx ON email_templates(case_request_id) WHERE case_request_id IS NOT NULL;
CREATE TABLE IF NOT EXISTS email_template_attachments (
id SERIAL PRIMARY KEY,
template_id INTEGER NOT NULL REFERENCES email_templates(id) ON DELETE CASCADE,
filename TEXT NOT NULL,
content_type TEXT NOT NULL,
content BYTEA NOT NULL,
size_bytes INTEGER NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS email_template_attachments_template_idx ON email_template_attachments(template_id);