bmc_hub/migrations/1055_vendor_resources.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

26 lines
1.0 KiB
SQL

-- Additive supplier resources. Existing contacts, mails and cases are preserved.
CREATE TABLE IF NOT EXISTS vendor_files (
id SERIAL PRIMARY KEY,
vendor_id INTEGER NOT NULL REFERENCES vendors(id),
filename TEXT NOT NULL,
content_type TEXT NOT NULL,
size_bytes INTEGER NOT NULL,
content_data BYTEA NOT NULL,
uploaded_by_user_id INTEGER REFERENCES users(user_id),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_vendor_files_vendor ON vendor_files(vendor_id, created_at DESC);
CREATE TABLE IF NOT EXISTS vendor_contacts (
vendor_id INTEGER NOT NULL REFERENCES vendors(id),
contact_id INTEGER NOT NULL REFERENCES contacts(id),
role VARCHAR(100),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (vendor_id, contact_id)
);
CREATE TABLE IF NOT EXISTS vendor_case_links (
vendor_id INTEGER NOT NULL REFERENCES vendors(id),
sag_id INTEGER NOT NULL REFERENCES sag_sager(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (vendor_id, sag_id)
);