-- opendrs-update.sql

-- ---------- version 1.1.0 -------------
-- Update version number
UPDATE config SET name="drs_version" WHERE name="mts_version";
UPDATE config SET value="1.1.0",defaultvalue="1.1.0" WHERE name="drs_version";

-- Add period_eff_help_txt to config table
INSERT INTO config(name,value,defaultvalue)
SELECT * FROM 
(SELECT 'period_eff_help_txt',
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' AS wval,
'If maintenance issues prevented the training objectives from being achieved and you will have to come back and redo the same training, answer Non-effective. Otherwise, answer Effective.' AS dval
)
AS tmp
WHERE NOT EXISTS 
(
SELECT name FROM config WHERE name = 'period_eff_help_txt'
) LIMIT 1
;
-- --------------------------------------

-- ---------- version 1.1.1 -------------
-- Update version number
UPDATE config SET value="1.1.1",defaultvalue="1.1.1" WHERE name="drs_version";

-- Rename the trainers table to devices
RENAME TABLE trainers TO devices;

-- Update default app name
UPDATE config SET defaultvalue="OpenDRS Discrepancy Reporting System" WHERE name="app_name";

-- Update default session directories
UPDATE config SET defaultvalue="/tmp/opendrs/opendrs/sessions" WHERE name="unix_server_session_dir";
UPDATE config SET defaultvalue="c:\Windows\Temp\opendrs\opendrs\sessions" WHERE name="win_server_session_dir";
-- --------------------------------------
