-- MARS-828: Rollback archival strategy columns
-- Author: Grzegorz Michalski
-- Date: 2026-01-27
-- Description: Remove ARCHIVAL_STRATEGY, MINIMUM_AGE_MONTHS, IS_ARCHIVE_ENABLED, and IS_KEEP_IN_TRASH columns

PROMPT ========================================
PROMPT MARS-828: Removing archival strategy and config columns
PROMPT ========================================

-- Drop check constraints first
ALTER TABLE CT_MRDS.A_SOURCE_FILE_CONFIG 
DROP CONSTRAINT CHK_ARCHIVAL_STRATEGY;

ALTER TABLE CT_MRDS.A_SOURCE_FILE_CONFIG 
DROP CONSTRAINT CHK_IS_ARCHIVE_ENABLED;

ALTER TABLE CT_MRDS.A_SOURCE_FILE_CONFIG 
DROP CONSTRAINT CHK_IS_KEEP_IN_TRASH;

-- Drop columns
ALTER TABLE CT_MRDS.A_SOURCE_FILE_CONFIG DROP (
    ARCHIVAL_STRATEGY,
    MINIMUM_AGE_MONTHS
);

ALTER TABLE CT_MRDS.A_SOURCE_FILE_CONFIG DROP (
    IS_ARCHIVE_ENABLED,
    IS_KEEP_IN_TRASH
);

-- Verify columns dropped
SELECT 
    column_name
FROM all_tab_columns 
WHERE owner = 'CT_MRDS' 
  AND table_name = 'A_SOURCE_FILE_CONFIG'
  AND column_name IN ('ARCHIVAL_STRATEGY', 'MINIMUM_AGE_MONTHS', 'IS_ARCHIVE_ENABLED', 'IS_KEEP_IN_TRASH');

PROMPT ========================================
PROMPT Archival strategy and config columns removed successfully
PROMPT ========================================
