-- +goose Down
-- SQL in this section is executed when the migration is rolled back

-- Drop tables
DROP TABLE IF EXISTS social_links;
DROP TABLE IF EXISTS navigation_items;

-- Remove settings columns
DO $$
BEGIN
    IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'settings') THEN
        IF EXISTS (SELECT 1 FROM information_schema.columns 
                  WHERE table_name = 'settings' AND column_name = 'custom_navigation_enabled') THEN
            ALTER TABLE settings DROP COLUMN custom_navigation_enabled;
        END IF;
        
        IF EXISTS (SELECT 1 FROM information_schema.columns 
                  WHERE table_name = 'settings' AND column_name = 'show_social_in_nav') THEN
            ALTER TABLE settings DROP COLUMN show_social_in_nav;
        END IF;
    END IF;
END $$;
