-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #565 from groldan/bug/caching_add_service_and_sett…
…ings_wont_clear_cache Fix saving workspace services not working with pgconfig
- Loading branch information
Showing
5 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
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
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
43 changes: 43 additions & 0 deletions
43
...n/resources/db/pgconfig/migration/postgresql/V1_8__ServiceInfoSettingsInfoConstraints.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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Add referential integrity constraint from: | ||
* | ||
* - settingsinfo(workspace) -> workspaceindo(id) | ||
* - serviceinfo(workspace) -> workspaceinfo(id) | ||
* | ||
* And unique indexes for: | ||
* | ||
* - settingsinfo(workspace) | ||
* - serviceinfo("@type", workspace) | ||
*/ | ||
|
||
|
||
ALTER TABLE settingsinfo | ||
ADD CONSTRAINT fk_settingsinfo_workspace | ||
FOREIGN KEY (workspace) | ||
REFERENCES workspaceinfo(id) | ||
ON DELETE CASCADE; | ||
|
||
CREATE UNIQUE INDEX settingsinfo_workspace_key | ||
ON settingsinfo (workspace) | ||
NULLS NOT DISTINCT; | ||
|
||
/* | ||
* Delete possible duplicate serviceinfos by type and workspace before enforcing uniqueness. | ||
*/ | ||
DELETE FROM serviceinfo WHERE id IN( select id FROM ( | ||
SELECT id, | ||
ROW_NUMBER() OVER(PARTITION BY "@type", workspace ORDER BY id ASC) AS duprow | ||
FROM serviceinfo | ||
) dups | ||
WHERE | ||
dups.duprow > 1); | ||
|
||
ALTER TABLE serviceinfo | ||
ADD CONSTRAINT fk_serviceinfo_workspace | ||
FOREIGN KEY (workspace) | ||
REFERENCES workspaceinfo(id) | ||
ON DELETE CASCADE; | ||
|
||
CREATE UNIQUE INDEX serviceinfo_workspace_key | ||
ON serviceinfo ("@type", workspace) | ||
NULLS NOT DISTINCT; |
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
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