npi-2026/db/init/006_attachments.sql
DJP 26d3eb03ed Initial commit — NPI Tracker application
Full-stack NPI (New Product Introduction) gate tracking tool with:
- Express/TypeScript API with PostgreSQL
- React/Vite/Mantine frontend
- 13-gate process (G0-G12) with 4 product categories
- RACI matrix auto-population from templates
- File attachments with preview (images, PDFs, text)
- Kanban board, Gantt/timeline views
- Docker Compose orchestration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 14:36:31 -04:00

17 lines
664 B
SQL

-- File attachments for projects, checklist items, and status updates
CREATE TABLE attachments (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
entity_type VARCHAR(50) NOT NULL,
entity_id UUID,
original_filename VARCHAR(500) NOT NULL,
stored_filename VARCHAR(500) NOT NULL,
mime_type VARCHAR(100) NOT NULL,
file_size_bytes INTEGER NOT NULL,
uploaded_by_name VARCHAR(255),
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX idx_attachments_project ON attachments(project_id);
CREATE INDEX idx_attachments_entity ON attachments(entity_type, entity_id);