-- Remove the settings rows superseded by the advertisements table.
--
-- Migration 028 moved advertisements into `ad_creatives` and deliberately left
-- the old rows in place so an upgrade could be verified before anything was
-- discarded. Nothing reads them any more: the per-placement mode, code, image,
-- link, alt, dimensions and device flags are all columns on `ad_creatives`,
-- and `ads.head_code` moved to `custom_code_snippets` in migration 025.
--
-- They are removed now because they are stale copies of raw advertisement code
-- that are re-read on every settings load.
--
-- Deliberately kept, because they are still live placement configuration:
--   ads.enabled
--   ads.{placement}.rotation
--   ads.between_answers.interval
--   ads.between_answers.max_insertions
--
-- Forward-only and safe to re-run: deleting rows that are already gone is a
-- no-op.

DELETE FROM settings
WHERE `key` IN (
    'ads.head_code',

    'ads.header.mode', 'ads.header.code', 'ads.header.image_url', 'ads.header.link_url',
    'ads.header.alt', 'ads.header.image_width', 'ads.header.image_height',
    'ads.header.show_desktop', 'ads.header.show_tablet', 'ads.header.show_mobile',

    'ads.footer.mode', 'ads.footer.code', 'ads.footer.image_url', 'ads.footer.link_url',
    'ads.footer.alt', 'ads.footer.image_width', 'ads.footer.image_height',
    'ads.footer.show_desktop', 'ads.footer.show_tablet', 'ads.footer.show_mobile',

    'ads.homepage.mode', 'ads.homepage.code', 'ads.homepage.image_url', 'ads.homepage.link_url',
    'ads.homepage.alt', 'ads.homepage.image_width', 'ads.homepage.image_height',
    'ads.homepage.show_desktop', 'ads.homepage.show_tablet', 'ads.homepage.show_mobile',

    'ads.after_question.mode', 'ads.after_question.code', 'ads.after_question.image_url',
    'ads.after_question.link_url', 'ads.after_question.alt',
    'ads.after_question.image_width', 'ads.after_question.image_height',
    'ads.after_question.show_desktop', 'ads.after_question.show_tablet', 'ads.after_question.show_mobile',

    'ads.between_answers.mode', 'ads.between_answers.code', 'ads.between_answers.image_url',
    'ads.between_answers.link_url', 'ads.between_answers.alt',
    'ads.between_answers.image_width', 'ads.between_answers.image_height',
    'ads.between_answers.show_desktop', 'ads.between_answers.show_tablet', 'ads.between_answers.show_mobile'
);
