cleaned up 1-sanitize_init.sql

master
dtookey 4 years ago
parent e3a13374db
commit 8c0115871b

@ -1,8 +1,9 @@
# Table removal
DROP TABLE IF EXISTS tokens;
CREATE OR REPLACE INDEX billing_refnum ON billing (refNumber);
# Column changes
-- noinspection SqlWithoutWhere
UPDATE users
SET hash = '';
@ -10,26 +11,37 @@ UPDATE project_lifecycle
SET new_value = '+CREATED',
changed_column = 'status'
WHERE changed_column = 'created';
# Column deletions
DELETE
FROM project_lifecycle
WHERE project_number = 'EVENT';
#for some reason, Datastudio won't let us change the timezone, so it reports everything in UTC. This is the current workaround
# TZ ADJUSTMENT
# 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);
CREATE OR REPLACE INDEX lifecycle_newval on project_lifecycle (new_value);

Loading…
Cancel
Save