Yair Zaslavsky has uploaded a new change for review. Change subject: core: Add foreign keys from async_tasks to command_entities ......................................................................
core: Add foreign keys from async_tasks to command_entities Change-Id: If66661c75806fbad7821c9a2c9ffebabdeabe485 Bug-Url: https://bugzilla.redhat.com/1161012 Signed-off-by: Yair Zaslavsky <[email protected]> --- M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AsyncTaskDAOTest.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java M backend/manager/modules/dal/src/test/resources/fixtures.xml A packaging/dbscripts/upgrade/03_06_0530_add_foreign_keys_to_async_tasks_table.sql 4 files changed, 20 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/35219/1 diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AsyncTaskDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AsyncTaskDAOTest.java index b50c70f..0105f75 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AsyncTaskDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AsyncTaskDAOTest.java @@ -62,8 +62,8 @@ newAsyncTask.setresult(AsyncTaskResultEnum.success); newAsyncTask.setActionParameters(params); newAsyncTask.setTaskParameters(taskParams); - newAsyncTask.setCommandId(Guid.newGuid()); - newAsyncTask.setRootCommandId(Guid.newGuid()); + newAsyncTask.setCommandId(FixturesTool.COMMAND_ID); + newAsyncTask.setRootCommandId(FixturesTool.ROOT_COMMAND_ID); newAsyncTask.setTaskType(AsyncTaskType.copyImage); newAsyncTask.setStoragePoolId(Guid.newGuid()); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java index 2c6b50a..e492c99 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java @@ -656,4 +656,7 @@ public static final Guid CPU_PROFILE_1 = new Guid("fd81f1e1-785b-4579-ab75-1419ebb87052"); public static final Guid CPU_PROFILE_2 = new Guid("fd81f1e1-785b-4579-ab75-1419ebb87053"); + + public static final Guid COMMAND_ID = new Guid("340fd52b-3400-4cdd-8d3f-c9d03704b0a1"); + public static final Guid ROOT_COMMAND_ID = new Guid("440fd52b-3400-4cdd-8d3f-c9d03704b0aa"); } diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index a113f54..db38498 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -54,6 +54,14 @@ <column>command_parameters</column> <column>status</column> <row> + <value>440fd52b-3400-4cdd-8d3f-c9d03704b0aa</value> + <value>230</value> + <null/> + <value>2010-11-29 15:57:10</value> + <null/> + <value>ACTIVE</value> + </row> + <row> <value>340fd52b-3400-4cdd-8d3f-c9d03704b0a1</value> <value>230</value> <null/> @@ -78,7 +86,7 @@ <value>ACTIVE</value> </row> <row> - <value>440fd52b-3400-4cdd-8d3f-c9d03704b0aa</value> + <value>340fd52b-3400-4cdd-8d3f-c9d03704b0aa</value> <value>1</value> <null/> <value>2010-11-29 15:57:10</value> @@ -86,7 +94,7 @@ <value>ACTIVE</value> </row> <row> - <value>440fd52b-3400-4cdd-8d3f-c9d03704b0ab</value> + <value>340fd52b-3400-4cdd-8d3f-c9d03704b0ab</value> <value>1</value> <null/> <value>2010-11-29 15:57:10</value> @@ -124,7 +132,7 @@ <value>2</value> <!-- Running --> <value>0</value> <!-- Success --> <value>340fd52b-3400-4cdd-8d3f-c9d03704b0ab</value> - <value>440fd52b-3400-4cdd-8d3f-c9d03704b0ab</value> + <value>440fd52b-3400-4cdd-8d3f-c9d03704b0aa</value> <value>2010-12-01 14:13:07</value> <value>6d849ebf-755f-4552-ad09-9a090cda105d</value> <value>3</value> diff --git a/packaging/dbscripts/upgrade/03_06_0530_add_foreign_keys_to_async_tasks_table.sql b/packaging/dbscripts/upgrade/03_06_0530_add_foreign_keys_to_async_tasks_table.sql new file mode 100644 index 0000000..338029d --- /dev/null +++ b/packaging/dbscripts/upgrade/03_06_0530_add_foreign_keys_to_async_tasks_table.sql @@ -0,0 +1,4 @@ +SELECT fn_db_create_constraint('async_tasks', 'fk_async_tasks_command_entities_command_id', 'FOREIGN KEY (command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); +SELECT fn_db_create_constraint('async_tasks', 'fk_async_tasks_command_entities_root_command_id', 'FOREIGN KEY (root_command_id) REFERENCES command_entities(command_id) ON DELETE CASCADE'); + + -- To view, visit http://gerrit.ovirt.org/35219 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If66661c75806fbad7821c9a2c9ffebabdeabe485 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Yair Zaslavsky <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
