Rename semi-temporary table so that it is at the end asciibetically
_temp_request_configuration_change ⇒ zz__temp_request_configuration_change);
This commit is contained in:
parent
07f0b6aad6
commit
9f79b490f6
1 changed files with 19 additions and 19 deletions
|
@ -223,9 +223,9 @@ SELECT CASE
|
|||
END;
|
||||
-- -------------- VIEW: UserOperation_fix_tshirt_size_request ---------------------
|
||||
|
||||
DROP TABLE IF EXISTS "_temp_request_configuration_change";
|
||||
DROP TABLE IF EXISTS "zz__temp_request_configuration_change";
|
||||
|
||||
CREATE TABLE _temp_request_configuration_change(
|
||||
CREATE TABLE zz__temp_request_configuration_change(
|
||||
old_request_configuration_id integer,
|
||||
new_request_configuration_id integer,
|
||||
new_description varchar(100) NOT NULL);
|
||||
|
@ -248,17 +248,17 @@ CREATE TRIGGER fix_tshirt_size_request_updater
|
|||
INSTEAD OF UPDATE OF size_requested on UserOperation_fix_tshirt_size_request
|
||||
BEGIN
|
||||
|
||||
DELETE FROM _temp_request_configuration_change;
|
||||
DELETE FROM zz__temp_request_configuration_change;
|
||||
|
||||
INSERT INTO _temp_request_configuration_change(new_description) VALUES(NEW.size_requested);
|
||||
INSERT INTO zz__temp_request_configuration_change(new_description) VALUES(NEW.size_requested);
|
||||
|
||||
update _temp_request_configuration_change set new_request_configuration_id = (select rc.id
|
||||
update zz__temp_request_configuration_change set new_request_configuration_id = (select rc.id
|
||||
from request_configuration rc, request_type rt
|
||||
where rc.description = NEW.size_requested
|
||||
and rt.id = rc.request_type_id
|
||||
and rt.type = OLD.shirt_requested)
|
||||
WHERE new_description = NEW.size_requested;
|
||||
UPDATE _temp_request_configuration_change set old_request_configuration_id =
|
||||
UPDATE zz__temp_request_configuration_change set old_request_configuration_id =
|
||||
(SELECT rc.id
|
||||
FROM request_configuration rc, request_type rt
|
||||
where rc.description = OLD.size_requested
|
||||
|
@ -268,18 +268,18 @@ UPDATE _temp_request_configuration_change set old_request_configuration_id =
|
|||
AND new_request_configuration_id IS NOT NULL;
|
||||
|
||||
SELECT CASE
|
||||
WHEN ( (SELECT new_request_configuration_id from _temp_request_configuration_change) IS NULL )
|
||||
WHEN ( (SELECT new_request_configuration_id from zz__temp_request_configuration_change) IS NULL )
|
||||
THEN RAISE(FAIL, "Invalid t-shirt size for this particular t-shirt style!")
|
||||
END;
|
||||
|
||||
UPDATE request
|
||||
set request_configuration_id =
|
||||
(select new_request_configuration_id from _temp_request_configuration_change)
|
||||
(select new_request_configuration_id from zz__temp_request_configuration_change)
|
||||
where id = OLD.request_id
|
||||
and request_configuration_id =
|
||||
(select old_request_configuration_id from _temp_request_configuration_change);
|
||||
(select old_request_configuration_id from zz__temp_request_configuration_change);
|
||||
|
||||
DELETE FROM _temp_request_configuration_change;
|
||||
DELETE FROM zz__temp_request_configuration_change;
|
||||
|
||||
END;
|
||||
|
||||
|
@ -383,11 +383,11 @@ CREATE TRIGGER contact_setting_config_change_updater
|
|||
INSTEAD OF UPDATE OF setting_requested on UserOperation_contact_setting_change
|
||||
BEGIN
|
||||
|
||||
DELETE FROM _temp_request_configuration_change;
|
||||
DELETE FROM zz__temp_request_configuration_change;
|
||||
|
||||
INSERT INTO _temp_request_configuration_change(new_description) VALUES(NEW.setting_requested);
|
||||
INSERT INTO zz__temp_request_configuration_change(new_description) VALUES(NEW.setting_requested);
|
||||
|
||||
UPDATE _temp_request_configuration_change
|
||||
UPDATE zz__temp_request_configuration_change
|
||||
SET new_request_configuration_id =
|
||||
(SELECT rc.id FROM request_configuration rc, request_type rt
|
||||
WHERE rc.description = NEW.setting_requested
|
||||
|
@ -395,7 +395,7 @@ UPDATE _temp_request_configuration_change
|
|||
AND rt.id = 12)
|
||||
WHERE new_description = NEW.setting_requested;
|
||||
|
||||
UPDATE _temp_request_configuration_change set old_request_configuration_id =
|
||||
UPDATE zz__temp_request_configuration_change set old_request_configuration_id =
|
||||
(SELECT rc.id
|
||||
FROM request_configuration rc, request_type rt
|
||||
where rc.description = OLD.setting_requested
|
||||
|
@ -405,13 +405,13 @@ UPDATE _temp_request_configuration_change set old_request_configuration_id =
|
|||
AND new_request_configuration_id IS NOT NULL;
|
||||
|
||||
SELECT CASE
|
||||
WHEN ( (SELECT new_request_configuration_id from _temp_request_configuration_change) IS NULL )
|
||||
WHEN ( (SELECT new_request_configuration_id from zz__temp_request_configuration_change) IS NULL )
|
||||
THEN RAISE(FAIL, "Invalid contact setting; see UserQuery_contact_settings to find what settings are permitted here!")
|
||||
END;
|
||||
|
||||
INSERT OR IGNORE INTO request(donor_id, request_type_id, request_configuration_id, date_requested, notes)
|
||||
VALUES(NEW.donor_id, 12,
|
||||
(SELECT new_request_configuration_id from _temp_request_configuration_change),
|
||||
(SELECT new_request_configuration_id from zz__temp_request_configuration_change),
|
||||
date("now"), NEW.note);
|
||||
|
||||
-- The following UPDATE will effect 0 rows if OLD.request_id is NULL and this is *by design*.
|
||||
|
@ -422,16 +422,16 @@ INSERT OR IGNORE INTO request(donor_id, request_type_id, request_configurati
|
|||
|
||||
UPDATE request
|
||||
SET request_configuration_id =
|
||||
(select new_request_configuration_id from _temp_request_configuration_change),
|
||||
(select new_request_configuration_id from zz__temp_request_configuration_change),
|
||||
date_requested = date("now")
|
||||
WHERE id = OLD.request_id
|
||||
AND OLD.request_id is NOT NULL
|
||||
AND OLD.donor_id = donor_id
|
||||
AND request_type_id = 12
|
||||
AND request_configuration_id =
|
||||
(select old_request_configuration_id from _temp_request_configuration_change);
|
||||
(select old_request_configuration_id from zz__temp_request_configuration_change);
|
||||
|
||||
DELETE FROM _temp_request_configuration_change;
|
||||
DELETE FROM zz__temp_request_configuration_change;
|
||||
|
||||
END;
|
||||
-- -------------- VIEW: UserOperation_contact_setting_change ---------------------
|
||||
|
|
Loading…
Reference in a new issue