-- Kabar Gamalama V46: Berita Pilihan Redaksi
-- Jalankan satu kali pada database kabar_gamalama.
CREATE TABLE IF NOT EXISTS editorial_picks (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  article_id BIGINT UNSIGNED NOT NULL,
  sort_order INT NOT NULL DEFAULT 0,
  is_active TINYINT(1) NOT NULL DEFAULT 1,
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  UNIQUE KEY uq_editorial_picks_article (article_id),
  INDEX idx_editorial_picks_active_sort (is_active, sort_order, created_at),
  CONSTRAINT fk_editorial_picks_article FOREIGN KEY (article_id)
    REFERENCES articles(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
