-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4db18b8
commit b052d4f
Showing
9 changed files
with
47 additions
and
303 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 30 additions & 23 deletions
53
src/main/resources/archetype-resources/src/sql-config/dbmigrate/200_add_config_parameter.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
DO $$ | ||
|
||
|
||
-- DROP FUNCTION oms.add_config_parameter(bigint, character varying, character varying, character varying); | ||
CREATE OR REPLACE FUNCTION oms.add_s2s_config_parameter( | ||
p_shop2supplierref bigint, | ||
p_configtype varchar, | ||
p_key varchar, | ||
p_value varchar) | ||
RETURNS void AS | ||
$$ | ||
|
||
BEGIN | ||
|
||
-- DROP FUNCTION oms.add_config_parameter(bigint, character varying, character varying, character varying); | ||
CREATE OR REPLACE FUNCTION oms.add_config_parameter( | ||
p_shop2supplierref bigint, | ||
p_configtype character varying, | ||
p_key character varying, | ||
p_value character varying) | ||
RETURNS void AS | ||
$BODY$BEGIN | ||
IF NOT EXISTS (SELECT 1 FROM oms."CustomConfigurationDO" where "shop2SupplierRef" = p_shop2supplierref and "configType" = p_configtype) THEN | ||
INSERT INTO oms."CustomConfigurationDO" ("id", "shop2SupplierRef", "configType") | ||
SELECT nextval('oms."CustomConfigurationDO_id_seq"'), p_shop2supplierref, p_configtype; | ||
END IF; | ||
IF p_key IS NOT NULL THEN | ||
insert into oms."CustomConfigurationDO_AV" ("customConfigurationRef", key, value) | ||
select (select id from oms."CustomConfigurationDO" where "shop2SupplierRef" = p_shop2supplierref and "configType" = p_configtype), p_key, p_value | ||
ON CONFLICT ("customConfigurationRef", key) DO UPDATE SET value = p_value; | ||
END IF; | ||
END; | ||
$BODY$ | ||
LANGUAGE plpgsql VOLATILE | ||
COST 100; | ||
INSERT INTO oms."CustomConfigurationDO" ("id", "shop2SupplierRef", "configType") | ||
SELECT nextval('oms."CustomConfigurationDO_id_seq"'), p_shop2supplierref, p_configtype | ||
WHERE NOT EXISTS (select 1 FROM oms."CustomConfigurationDO" | ||
where "shop2SupplierRef" = p_shop2supplierref and "configType" = p_configtype); | ||
|
||
IF p_key IS NOT NULL THEN | ||
INSERT INTO oms."CustomConfigurationDO_AV" ("customConfigurationRef", key, value) | ||
SELECT (select id from oms."CustomConfigurationDO" where "shop2SupplierRef" = p_shop2supplierref and "configType" = p_configtype), p_key, p_value | ||
ON CONFLICT ("customConfigurationRef", key) DO UPDATE SET value = p_value; | ||
END IF; | ||
|
||
END; | ||
$$; | ||
|
||
$$ | ||
LANGUAGE plpgsql VOLATILE; | ||
|
||
comment on function oms.add_s2s_config_parameter( | ||
p_shop2supplierref bigint, | ||
p_configtype varchar, | ||
p_key varchar, | ||
p_value varchar) is 'add config values for a given Shop2SupplierDO / configType'; |
48 changes: 0 additions & 48 deletions
48
...n/resources/archetype-resources/src/sql-config/dbmigrate/201_create_or_update_payment.sql
This file was deleted.
Oops, something went wrong.
91 changes: 0 additions & 91 deletions
91
...main/resources/archetype-resources/src/sql-config/dbmigrate/202_create_or_update_shop.sql
This file was deleted.
Oops, something went wrong.
72 changes: 0 additions & 72 deletions
72
...urces/archetype-resources/src/sql-config/dbmigrate/203_create_or_update_shop2supplier.sql
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
src/main/resources/archetype-resources/src/sql-config/dbmigrate/206_s2s_id.sql
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
src/main/resources/archetype-resources/src/sql-config/dbmigrate/207_upsert_eb_value.sql
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
src/main/resources/archetype-resources/src/sql-config/dbmigrate/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### Example functions | ||
In case you are missing the "old" PSQL helper functions please have a look at the blueprint project. | ||
|
||
See: [Github Repo iom-blueprint-project](https://github.com/intershop/iom-blueprint-project/tree/main/src/sql-config/dbmigrate) |