-
Notifications
You must be signed in to change notification settings - Fork 13
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 #264 from technologiestiftung/staging
Staging to prod: treeIds migration
- Loading branch information
Showing
6 changed files
with
12,910 additions
and
12,884 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
ALTER TABLE trees_watered DROP CONSTRAINT fk_trees_watered_trees; | ||
UPDATE trees_watered SET tree_id = (SELECT gml_id FROM trees WHERE trees.id = trees_watered.tree_id); | ||
|
||
ALTER TABLE trees_adopted DROP CONSTRAINT fk_trees_adopted_trees; | ||
UPDATE trees_adopted SET tree_id = (SELECT gml_id FROM trees WHERE trees.id = trees_adopted.tree_id); | ||
|
||
UPDATE trees SET id = gml_id; | ||
|
||
ALTER TABLE trees_watered | ||
ADD CONSTRAINT fk_trees_watered_trees | ||
FOREIGN KEY (tree_id) | ||
REFERENCES trees (id) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE; | ||
|
||
ALTER TABLE trees_adopted | ||
ADD CONSTRAINT fk_trees_adopted_trees | ||
FOREIGN KEY (tree_id) | ||
REFERENCES trees (id) | ||
ON DELETE CASCADE | ||
ON UPDATE CASCADE; | ||
|
||
ALTER TABLE trees DROP COLUMN gml_id; | ||
|
||
DROP TRIGGER insert_uuid on public.trees; | ||
DROP FUNCTION public.uuid_insert_trigger; |
Oops, something went wrong.