-- db/init.sql
-- Создаёт таблицы для хранения кейсов и файлов
CREATE TABLE IF NOT EXISTS cases (
    id SERIAL PRIMARY KEY,
    violator_url TEXT NOT NULL,
    violator_article VARCHAR(50) NOT NULL,
    my_article VARCHAR(50),
    comment TEXT,
    status VARCHAR(20) DEFAULT 'new',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS files (
    id SERIAL PRIMARY KEY,
    case_id INT REFERENCES cases(id) ON DELETE CASCADE,
    file_path TEXT NOT NULL,
    uploaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
