-- Reverses 040_seed_concepts_and_backfill. Clears concept_id +
-- legal_source on the affected rules, then deletes the seed concept
-- rows. The columns themselves stay (dropped in 038's down).

UPDATE paliad.deadline_rules
   SET legal_source = NULL,
       concept_id   = NULL
 WHERE concept_id IS NOT NULL
   AND proceeding_type_id IN (
        SELECT id FROM paliad.proceeding_types WHERE category = 'fristenrechner'
       );

DELETE FROM paliad.deadline_concepts
 WHERE slug IN (
    'statement-of-claim','application-for-revocation',
    'application-for-provisional-measures','application-for-determination-of-damages',
    'request-to-lay-open-books','statement-of-defence','reply-to-defence','rejoinder',
    'notice-of-appeal','statement-of-grounds-of-appeal','response-to-appeal',
    'cross-appeal','reply-to-cross-appeal','appeal-with-leave',
    'request-for-discretionary-review','application-for-leave-to-appeal',
    'application-for-cost-decision','opposition','request-for-examination',
    'approval-and-translation','filing','oral-hearing','interim-conference',
    'decision','order','cost-decision','search-report','publication',
    'communication-r71-3','grant'
 );
