mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1.6 KiB
SQL
31 lines
1.6 KiB
SQL
|
|
-- Add missing columns to violations table for full violation management
|
|
ALTER TABLE public.violations ADD COLUMN IF NOT EXISTS stage text;
|
|
ALTER TABLE public.violations ADD COLUMN IF NOT EXISTS photo_url text;
|
|
ALTER TABLE public.violations ADD COLUMN IF NOT EXISTS photo_urls jsonb;
|
|
ALTER TABLE public.violations ADD COLUMN IF NOT EXISTS notice_level text;
|
|
ALTER TABLE public.violations ADD COLUMN IF NOT EXISTS notice_history jsonb;
|
|
ALTER TABLE public.violations ADD COLUMN IF NOT EXISTS timeline_entries jsonb;
|
|
ALTER TABLE public.violations ADD COLUMN IF NOT EXISTS assigned_to uuid;
|
|
|
|
-- Add missing columns to violation_types table
|
|
ALTER TABLE public.violation_types ADD COLUMN IF NOT EXISTS article_section text;
|
|
ALTER TABLE public.violation_types ADD COLUMN IF NOT EXISTS citation text;
|
|
ALTER TABLE public.violation_types ADD COLUMN IF NOT EXISTS requested_action text;
|
|
|
|
-- Create violation-photos storage bucket
|
|
INSERT INTO storage.buckets (id, name, public) VALUES ('violation-photos', 'violation-photos', true)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- Allow authenticated users to upload to violation-photos
|
|
CREATE POLICY "Authenticated users can upload violation photos" ON storage.objects
|
|
FOR INSERT TO authenticated WITH CHECK (bucket_id = 'violation-photos');
|
|
|
|
-- Allow public read access to violation photos
|
|
CREATE POLICY "Public read access for violation photos" ON storage.objects
|
|
FOR SELECT TO public USING (bucket_id = 'violation-photos');
|
|
|
|
-- Allow authenticated users to delete their violation photos
|
|
CREATE POLICY "Authenticated users can delete violation photos" ON storage.objects
|
|
FOR DELETE TO authenticated USING (bucket_id = 'violation-photos');
|