-- Drop timestamp columns from marketing_products table if it exists
DO $$
BEGIN
    IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'marketing_products' AND column_name = 'created_at') THEN
        ALTER TABLE marketing_products DROP COLUMN created_at;
    END IF;
    IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'marketing_products' AND column_name = 'updated_at') THEN
        ALTER TABLE marketing_products DROP COLUMN updated_at;
    END IF;
    IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'marketing_products' AND column_name = 'deleted_at') THEN
        ALTER TABLE marketing_products DROP COLUMN deleted_at;
    END IF;
END $$;

-- Drop timestamp columns from marketing_delivery_products table if it exists
DO $$
BEGIN
    IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'marketing_delivery_products' AND column_name = 'created_at') THEN
        ALTER TABLE marketing_delivery_products DROP COLUMN created_at;
    END IF;
    IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'marketing_delivery_products' AND column_name = 'updated_at') THEN
        ALTER TABLE marketing_delivery_products DROP COLUMN updated_at;
    END IF;
    IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'marketing_delivery_products' AND column_name = 'deleted_at') THEN
        ALTER TABLE marketing_delivery_products DROP COLUMN deleted_at;
    END IF;
END $$;