CREATE TABLE IF NOT EXISTS posts (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    fb_post_id VARCHAR(50) UNIQUE,
    type ENUM('text', 'image', 'video', 'gallery', 'reel'),
    content TEXT,
    published_at DATETIME,
    likes INT DEFAULT 0,
    comments INT DEFAULT 0,
    shares INT DEFAULT 0
);

CREATE TABLE IF NOT EXISTS media (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    post_id BIGINT,
    type ENUM('image', 'video'),
    url VARCHAR(255),
    local_path VARCHAR(255),
    FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE
);
