DO $$
BEGIN
    IF EXISTS (
        SELECT 1 FROM pg_class
        WHERE oid = to_regclass('user_notifications') AND relkind = 'v'
    ) THEN
        DROP VIEW user_notifications;
    END IF;
END $$;
