summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main/resources
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-03-03 08:53:56 +0000
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2023-04-14 16:17:33 +0000
commit546c144518fae01ecad966149c2930655ac44c2a (patch)
tree16d53d88071b3cfcf615f7cb2c41acaaae443604 /cps-ri/src/main/resources
parentfb5f5c24db5c9fefa40a6d489ab533d3ad2b602f (diff)
Use cascade delete in fragments table
- Add Liquibase change to cascade delete fragments - Remove cascade delete logic from FragmentNativeRepository - Remove unused method deleteFragmentEntity Issue-ID: CPS-1617 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Iecf4f3022b402e0328609ddc11a879c83e5d7f30
Diffstat (limited to 'cps-ri/src/main/resources')
-rw-r--r--cps-ri/src/main/resources/changelog/changelog-master.yaml2
-rw-r--r--cps-ri/src/main/resources/changelog/db/changes/18-cascade-delete-fragment-children.yaml34
2 files changed, 36 insertions, 0 deletions
diff --git a/cps-ri/src/main/resources/changelog/changelog-master.yaml b/cps-ri/src/main/resources/changelog/changelog-master.yaml
index 43a54caf64..bf172d8eae 100644
--- a/cps-ri/src/main/resources/changelog/changelog-master.yaml
+++ b/cps-ri/src/main/resources/changelog/changelog-master.yaml
@@ -50,3 +50,5 @@ databaseChangeLog:
file: changelog/db/changes/16-insert-cm-handle-state.yaml
- include:
file: changelog/db/changes/17-add-index-to-schema-set-yang-resources.yaml
+ - include:
+ file: changelog/db/changes/18-cascade-delete-fragment-children.yaml
diff --git a/cps-ri/src/main/resources/changelog/db/changes/18-cascade-delete-fragment-children.yaml b/cps-ri/src/main/resources/changelog/db/changes/18-cascade-delete-fragment-children.yaml
new file mode 100644
index 0000000000..62a9e2f636
--- /dev/null
+++ b/cps-ri/src/main/resources/changelog/db/changes/18-cascade-delete-fragment-children.yaml
@@ -0,0 +1,34 @@
+databaseChangeLog:
+ - changeSet:
+ author: cps
+ id: 18
+ changes:
+ - dropForeignKeyConstraint:
+ baseTableName: fragment
+ constraintName: fragment_parent_id_fkey
+ - addForeignKeyConstraint:
+ baseColumnNames: parent_id
+ baseTableName: fragment
+ constraintName: fragment_parent_id_fkey
+ deferrable: false
+ initiallyDeferred: false
+ onDelete: CASCADE
+ onUpdate: NO ACTION
+ referencedColumnNames: id
+ referencedTableName: fragment
+ validate: true
+ rollback:
+ - dropForeignKeyConstraint:
+ baseTableName: fragment
+ constraintName: fragment_parent_id_fkey
+ - addForeignKeyConstraint:
+ baseColumnNames: parent_id
+ baseTableName: fragment
+ constraintName: fragment_parent_id_fkey
+ deferrable: false
+ initiallyDeferred: false
+ onDelete: NO ACTION
+ onUpdate: NO ACTION
+ referencedColumnNames: id
+ referencedTableName: fragment
+ validate: true