diff --git a/src/sql/0-run-first/1-sanitize_init.sql b/src/sql/0-run-first/1-sanitize_init.sql index 8b1806b..05724b3 100644 --- a/src/sql/0-run-first/1-sanitize_init.sql +++ b/src/sql/0-run-first/1-sanitize_init.sql @@ -1,9 +1,8 @@ -# Table removal DROP TABLE IF EXISTS tokens; -# Column changes --- noinspection SqlWithoutWhere +CREATE OR REPLACE INDEX billing_refnum ON billing (refNumber); +-- noinspection SqlWithoutWhere UPDATE users SET hash = ''; @@ -11,37 +10,26 @@ UPDATE project_lifecycle SET new_value = '+CREATED', changed_column = 'status' WHERE changed_column = 'created'; - -# Column deletions DELETE FROM project_lifecycle WHERE project_number = 'EVENT'; -# TZ ADJUSTMENT -# for some reason, Datastudio won't let us change the timezone, so it reports everything in UTC. This is the current workaround + +#for some reason, Datastudio won't let us change the timezone, so it reports everything in UTC. This is the current workaround SET @tz_adjust = 4; UPDATE billing SET accepted_date = accepted_date - INTERVAL @tz_adjust HOUR, line_created = line_created - INTERVAL @tz_adjust HOUR; - UPDATE dispatch SET date_dispatched = date_dispatched - INTERVAL @tz_adjust HOUR; - UPDATE project_comments -SET timestamp = timestamp - INTERVAL @tz_adjust HOUR; - +set timestamp = timestamp - INTERVAL @tz_adjust HOUR; UPDATE project_lifecycle SET timestamp = timestamp - INTERVAL @tz_adjust HOUR; -# ADDING ID COLUMNS ALTER TABLE project_lifecycle ADD COLUMN id INT AUTO_INCREMENT KEY FIRST; - - -# INDEXES -CREATE OR REPLACE INDEX billing_refnum ON billing (refNumber); - CREATE OR REPLACE INDEX lifecycle_timestamp on project_lifecycle (timestamp); - CREATE OR REPLACE INDEX lifecycle_newval on project_lifecycle (new_value); +