nordabiz/database/migrations/add_classified_attachments.sql
Maciej Pienczyn 699af41efa
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
feat: add image attachments to B2B classifieds
- New ClassifiedAttachment model with migration
- FileUploadService extended with 'classified' type
- Dropzone with drag & drop, paste, multi-file preview in creation form
- Image gallery with lightbox in classified detail view
- Max 10 files, 5MB each, JPG/PNG/GIF

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 07:13:24 +02:00

20 lines
802 B
SQL

-- Migration: Add classified_attachments table for B2B image uploads
-- Date: 2026-04-10
CREATE TABLE IF NOT EXISTS classified_attachments (
id SERIAL PRIMARY KEY,
classified_id INTEGER NOT NULL REFERENCES classifieds(id) ON DELETE CASCADE,
original_filename VARCHAR(255) NOT NULL,
stored_filename VARCHAR(255) NOT NULL UNIQUE,
file_extension VARCHAR(10) NOT NULL,
file_size INTEGER NOT NULL,
mime_type VARCHAR(100) NOT NULL,
uploaded_by INTEGER NOT NULL REFERENCES users(id),
created_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_classified_attachments_classified_id ON classified_attachments(classified_id);
GRANT ALL ON TABLE classified_attachments TO nordabiz_app;
GRANT USAGE, SELECT ON SEQUENCE classified_attachments_id_seq TO nordabiz_app;