-- ===================================================================
-- MARS-1049 ROLLBACK COMPONENT: Remove ENCODING Column
-- ===================================================================
-- Purpose: Remove ENCODING column from A_SOURCE_FILE_CONFIG table
-- Author: Grzegorz Michalski
-- Date: 2025-11-25
-- Version: 1.0.0
-- 
-- ROLLBACK OPERATION:
-- - Removes ENCODING VARCHAR2(50) column from CT_MRDS.A_SOURCE_FILE_CONFIG
-- - Part of complete MARS-1049 rollback sequence
-- 
-- USAGE:
-- - Can be executed standalone or as part of main rollback script
-- - Includes verification steps for safe execution
-- ===================================================================

PROMPT ===============================================
PROMPT MARS-1049: Remove ENCODING Column from A_SOURCE_FILE_CONFIG
PROMPT ===============================================

-- Step 1: Remove ENCODING column from A_SOURCE_FILE_CONFIG
PROMPT Step 1: Remove ENCODING column from A_SOURCE_FILE_CONFIG...
PROMPT ===============================================

-- First check if column exists
SELECT COUNT(*) AS ENCODING_COLUMN_EXISTS
FROM all_tab_columns 
WHERE owner = 'CT_MRDS' 
  AND table_name = 'A_SOURCE_FILE_CONFIG' 
  AND column_name = 'ENCODING';

-- Remove the ENCODING column
ALTER TABLE CT_MRDS.A_SOURCE_FILE_CONFIG DROP COLUMN ENCODING;

PROMPT ENCODING column removed from A_SOURCE_FILE_CONFIG

-- Final verification
SELECT COUNT(*) AS ENCODING_COLUMN_EXISTS_AFTER_REMOVAL
FROM all_tab_columns 
WHERE owner = 'CT_MRDS' 
  AND table_name = 'A_SOURCE_FILE_CONFIG' 
  AND column_name = 'ENCODING';

PROMPT ===============================================
PROMPT ENCODING column removal completed successfully
PROMPT ===============================================