DROP TABLE IF EXISTS news_images;

CREATE TABLE news_images (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    news_id INTEGER NOT NULL,
    filename VARCHAR(255),
    uri VARCHAR(255) NOT NULL,
    alt VARCHAR(255),
    sort_order INTEGER DEFAULT 0,
    FOREIGN KEY (news_id) REFERENCES news(id) ON DELETE CASCADE
);

CREATE INDEX IF NOT EXISTS idx_news_images_news_id ON news_images(news_id); 