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;
|
END;
|
||||||
-- -------------- VIEW: UserOperation_fix_tshirt_size_request ---------------------
|
-- -------------- 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,
|
old_request_configuration_id integer,
|
||||||
new_request_configuration_id integer,
|
new_request_configuration_id integer,
|
||||||
new_description varchar(100) NOT NULL);
|
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
|
INSTEAD OF UPDATE OF size_requested on UserOperation_fix_tshirt_size_request
|
||||||
BEGIN
|
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
|
from request_configuration rc, request_type rt
|
||||||
where rc.description = NEW.size_requested
|
where rc.description = NEW.size_requested
|
||||||
and rt.id = rc.request_type_id
|
and rt.id = rc.request_type_id
|
||||||
and rt.type = OLD.shirt_requested)
|
and rt.type = OLD.shirt_requested)
|
||||||
WHERE new_description = NEW.size_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
|
(SELECT rc.id
|
||||||
FROM request_configuration rc, request_type rt
|
FROM request_configuration rc, request_type rt
|
||||||
where rc.description = OLD.size_requested
|
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;
|
AND new_request_configuration_id IS NOT NULL;
|
||||||
|
|
||||||
SELECT CASE
|
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!")
|
THEN RAISE(FAIL, "Invalid t-shirt size for this particular t-shirt style!")
|
||||||
END;
|
END;
|
||||||
|
|
||||||
UPDATE request
|
UPDATE request
|
||||||
set request_configuration_id =
|
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
|
where id = OLD.request_id
|
||||||
and request_configuration_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;
|
END;
|
||||||
|
|
||||||
|
@ -383,11 +383,11 @@ CREATE TRIGGER contact_setting_config_change_updater
|
||||||
INSTEAD OF UPDATE OF setting_requested on UserOperation_contact_setting_change
|
INSTEAD OF UPDATE OF setting_requested on UserOperation_contact_setting_change
|
||||||
BEGIN
|
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 =
|
SET new_request_configuration_id =
|
||||||
(SELECT rc.id FROM request_configuration rc, request_type rt
|
(SELECT rc.id FROM request_configuration rc, request_type rt
|
||||||
WHERE rc.description = NEW.setting_requested
|
WHERE rc.description = NEW.setting_requested
|
||||||
|
@ -395,7 +395,7 @@ UPDATE _temp_request_configuration_change
|
||||||
AND rt.id = 12)
|
AND rt.id = 12)
|
||||||
WHERE new_description = NEW.setting_requested;
|
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
|
(SELECT rc.id
|
||||||
FROM request_configuration rc, request_type rt
|
FROM request_configuration rc, request_type rt
|
||||||
where rc.description = OLD.setting_requested
|
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;
|
AND new_request_configuration_id IS NOT NULL;
|
||||||
|
|
||||||
SELECT CASE
|
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!")
|
THEN RAISE(FAIL, "Invalid contact setting; see UserQuery_contact_settings to find what settings are permitted here!")
|
||||||
END;
|
END;
|
||||||
|
|
||||||
INSERT OR IGNORE INTO request(donor_id, request_type_id, request_configuration_id, date_requested, notes)
|
INSERT OR IGNORE INTO request(donor_id, request_type_id, request_configuration_id, date_requested, notes)
|
||||||
VALUES(NEW.donor_id, 12,
|
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);
|
date("now"), NEW.note);
|
||||||
|
|
||||||
-- The following UPDATE will effect 0 rows if OLD.request_id is NULL and this is *by design*.
|
-- 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
|
UPDATE request
|
||||||
SET request_configuration_id =
|
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")
|
date_requested = date("now")
|
||||||
WHERE id = OLD.request_id
|
WHERE id = OLD.request_id
|
||||||
AND OLD.request_id is NOT NULL
|
AND OLD.request_id is NOT NULL
|
||||||
AND OLD.donor_id = donor_id
|
AND OLD.donor_id = donor_id
|
||||||
AND request_type_id = 12
|
AND request_type_id = 12
|
||||||
AND request_configuration_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;
|
END;
|
||||||
-- -------------- VIEW: UserOperation_contact_setting_change ---------------------
|
-- -------------- VIEW: UserOperation_contact_setting_change ---------------------
|
||||||
|
|
Loading…
Reference in a new issue