ALTER TABLE media_categories
    ADD COLUMN IF NOT EXISTS cue_out_seconds decimal(6,2) NOT NULL DEFAULT 0.00 AFTER is_default,
    ADD COLUMN IF NOT EXISTS cross_seconds decimal(6,2) NOT NULL DEFAULT 0.00 AFTER cue_out_seconds,
    ADD COLUMN IF NOT EXISTS fade_in_seconds decimal(6,2) NOT NULL DEFAULT 0.00 AFTER cross_seconds,
    ADD COLUMN IF NOT EXISTS fade_out_seconds decimal(6,2) NOT NULL DEFAULT 0.00 AFTER fade_in_seconds;

UPDATE media_categories
SET content_type = 'jingle'
WHERE content_type = 'music'
  AND (LOWER(name) IN ('jingle', 'jingles') OR slug IN ('jingle', 'jingles'));

UPDATE media_categories
SET content_type = 'spot'
WHERE content_type = 'music'
  AND (LOWER(name) IN ('spot', 'spots', 'pub', 'pubs') OR slug IN ('spot', 'spots', 'pub', 'pubs', 'regie-pub'));

UPDATE media_categories
SET content_type = 'voice_track'
WHERE content_type = 'music'
  AND (LOWER(name) IN ('voice track', 'voice tracks', 'animateur') OR slug IN ('voice-track', 'voice-tracks', 'animateur'));

UPDATE media_categories
SET content_type = 'chronique'
WHERE content_type = 'music'
  AND (LOWER(name) IN ('chronique', 'chroniques') OR slug IN ('chronique', 'chroniques'));

UPDATE media_categories
SET content_type = 'podcast'
WHERE content_type = 'music'
  AND (LOWER(name) IN ('podcast', 'podcasts') OR slug IN ('podcast', 'podcasts'));

UPDATE media_categories
SET cue_out_seconds = 5.00,
    cross_seconds = 5.00,
    fade_in_seconds = 0.10,
    fade_out_seconds = 3.00
WHERE content_type = 'music';

UPDATE media_categories
SET cue_out_seconds = 0.00,
    cross_seconds = 0.30,
    fade_in_seconds = 0.50,
    fade_out_seconds = 0.20
WHERE content_type IN ('jingle', 'spot', 'voice_track', 'liner', 'top_horaire', 'bed', 'soundboard');

UPDATE media_categories
SET cue_out_seconds = 0.00,
    cross_seconds = 0.00,
    fade_in_seconds = 0.00,
    fade_out_seconds = 0.00
WHERE content_type IN ('chronique', 'podcast');

