-- Место проведения для мероприятий "для жителей": участок или дома отдельно
ALTER TABLE pr_events ADD COLUMN IF NOT EXISTS location_place_type VARCHAR(20) CHECK (location_place_type IN ('district', 'buildings'));
ALTER TABLE pr_events ADD COLUMN IF NOT EXISTS location_district_id VARCHAR(50) REFERENCES districts(id) ON DELETE SET NULL;
ALTER TABLE pr_events ADD COLUMN IF NOT EXISTS location_building_ids JSONB DEFAULT '[]';

COMMENT ON COLUMN pr_events.location_place_type IS 'Для жителей: district = участок, buildings = дома отдельно';
COMMENT ON COLUMN pr_events.location_district_id IS 'ID участка, если location_place_type = district';
COMMENT ON COLUMN pr_events.location_building_ids IS 'Массив ID домов, если location_place_type = buildings';
