CREATE TABLE IF NOT EXISTS product_media (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    product_id BIGINT UNSIGNED NOT NULL,
    position TINYINT UNSIGNED DEFAULT 0,
    type VARCHAR(20) NOT NULL,
    url VARCHAR(255) NULL,
    filename VARCHAR(255) NULL,
    mime VARCHAR(100) NULL,
    size INT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (product_id) REFERENCES products(id)
);