nidus-sync/db/migrations/00047_public_nuisance_pruning.sql

61 lines
3.9 KiB
MySQL
Raw Normal View History

-- +goose Up
ALTER TABLE publicreport.nuisance DROP COLUMN email;
ALTER TABLE publicreport.nuisance DROP COLUMN inspection_type;
ALTER TABLE publicreport.nuisance DROP COLUMN preferred_date_range;
ALTER TABLE publicreport.nuisance DROP COLUMN preferred_time;
ALTER TABLE publicreport.nuisance DROP COLUMN request_call;
ALTER TABLE publicreport.nuisance DROP COLUMN severity;
ALTER TABLE publicreport.nuisance DROP COLUMN source_roof;
ALTER TABLE publicreport.nuisance DROP COLUMN time_of_day_day;
ALTER TABLE publicreport.nuisance DROP COLUMN time_of_day_early;
ALTER TABLE publicreport.nuisance DROP COLUMN time_of_day_evening;
ALTER TABLE publicreport.nuisance DROP COLUMN time_of_day_night;
ALTER TABLE publicreport.nuisance ADD COLUMN source_gutter BOOLEAN;
UPDATE publicreport.nuisance SET source_gutter = FALSE;
ALTER TABLE publicreport.nuisance ALTER COLUMN source_gutter SET NOT NULL;
ALTER TABLE publicreport.nuisance DROP COLUMN reporter_address;
ALTER TABLE publicreport.nuisance ALTER COLUMN reporter_email DROP NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN reporter_name DROP NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN reporter_phone DROP NOT NULL;
-- +goose Down
ALTER TABLE publicreport.nuisance ALTER COLUMN reporter_phone SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN reporter_name SET NOT NULL;
ALTER TABLE publicreport.nuisance ALTER COLUMN reporter_email SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN reporter_address TEXT;
UPDATE publicreport.nuisance SET reporter_address = '';
ALTER TABLE publicreport.nuisance ALTER COLUMN reporter_address SET NOT NULL;
ALTER TABLE publicreport.nuisance DROP COLUMN source_gutter;
ALTER TABLE publicreport.nuisance ADD COLUMN time_of_day_day BOOLEAN;
UPDATE publicreport.nuisance SET time_of_day_day = FALSE;
ALTER TABLE publicreport.nuisance ALTER COLUMN time_of_day_day SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN time_of_day_early BOOLEAN;
UPDATE publicreport.nuisance SET time_of_day_early = FALSE;
ALTER TABLE publicreport.nuisance ALTER COLUMN time_of_day_early SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN time_of_day_evening BOOLEAN;
UPDATE publicreport.nuisance SET time_of_day_evening = FALSE;
ALTER TABLE publicreport.nuisance ALTER COLUMN time_of_day_evening SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN time_of_day_night BOOLEAN;
UPDATE publicreport.nuisance SET time_of_day_night = FALSE;
ALTER TABLE publicreport.nuisance ALTER COLUMN time_of_day_night SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN source_roof BOOLEAN;
UPDATE publicreport.nuisance SET source_roof = FALSE;
ALTER TABLE publicreport.nuisance ALTER COLUMN source_roof SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN severity SMALLINT;
UPDATE publicreport.nuisance SET severity = 0;
ALTER TABLE publicreport.nuisance ALTER COLUMN severity SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN request_call BOOLEAN;
UPDATE publicreport.nuisance SET request_call = FALSE;
ALTER TABLE publicreport.nuisance ALTER COLUMN request_call SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN preferred_time publicreport.NuisancePreferredTimeType;
UPDATE publicreport.nuisance SET preferred_time = 'none';
ALTER TABLE publicreport.nuisance ALTER COLUMN preferred_time SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN preferred_date_range publicreport.NuisancePreferredDateRangeType;
UPDATE publicreport.nuisance SET preferred_date_range = 'none';
ALTER TABLE publicreport.nuisance ALTER COLUMN preferred_date_range SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN inspection_type publicreport.NuisanceInspectionType;
UPDATE publicreport.nuisance SET inspection_type = 'neighborhood';
ALTER TABLE publicreport.nuisance ALTER COLUMN inspection_type SET NOT NULL;
ALTER TABLE publicreport.nuisance ADD COLUMN email TEXT;
UPDATE publicreport.nuisance SET email = '';
ALTER TABLE publicreport.nuisance ALTER COLUMN email SET NOT NULL;