erp-cicd/frontend/supabase/migrations/20250808163737_7317af23-a553-44cf-8fc4-29db964917b1.sql
Ali af6fd7bcad
All checks were successful
Build & Deploy Frontend / build-push-deploy (push) Successful in 1m45s
added some
2025-08-30 11:57:49 +05:30

18 lines
543 B
SQL

-- Ensure all services have category_id set
UPDATE public.services
SET category_id = (
SELECT id FROM public.categories
WHERE public.categories.name = public.services.category::text
)
WHERE category_id IS NULL;
-- Make category_id NOT NULL
ALTER TABLE public.services
ALTER COLUMN category_id SET NOT NULL;
-- Set default to the 'Other' category
ALTER TABLE public.services
ALTER COLUMN category_id SET DEFAULT '39904b37-b9ff-4a5f-af6f-88cb1169f6ab';
-- Drop the old category column
ALTER TABLE public.services DROP COLUMN category;