From 69e24a61f3535030b47f210f8ebe8601165fa006 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Wed, 24 Oct 2018 08:56:51 +0200 Subject: [PATCH] more tests --- migration/migration.go | 2 +- migration/migration_blackbox_test.go | 82 ++++++++----------- .../sql-files/111-cascading-soft-delete.sql | 53 ++++++------ .../111-cascading-soft-delete-update.sql | 56 ------------- .../111-cascading-soft-delete.sql | 60 ++++++++++++++ 5 files changed, 126 insertions(+), 127 deletions(-) delete mode 100644 migration/sql-test-files/111-cascading-soft-delete-update.sql create mode 100644 migration/sql-test-files/111-cascading-soft-delete.sql diff --git a/migration/migration.go b/migration/migration.go index 90169fbc36..5d631024fa 100644 --- a/migration/migration.go +++ b/migration/migration.go @@ -571,7 +571,7 @@ func MigrateToNextVersion(tx *sql.Tx, nextVersion *int64, m Migrations, catalog // Apply all the updates of the next version for j := range m[*nextVersion] { if err := m[*nextVersion][j](tx); err != nil { - return errs.Errorf("failed to execute migration of step %d of version %d: %s\n", j, *nextVersion, err) + return errs.Errorf("failed to execute migration step %d of version %d: %s\n", j, *nextVersion, err) } } diff --git a/migration/migration_blackbox_test.go b/migration/migration_blackbox_test.go index dc0a1c7003..5c25830798 100644 --- a/migration/migration_blackbox_test.go +++ b/migration/migration_blackbox_test.go @@ -1490,26 +1490,26 @@ func testMigration111CascadingSoftDelete(t *testing.T) { t.Run("setup test data to migrate", func(t *testing.T) { require.Nil(t, runSQLscript(sqlDB, "111-cascading-soft-delete.sql", - areaID, - areaDeletedID, - commentDeletedID, - commentID, - iterID, - iterDeletedID, - labelID, - labelDeletedID, - spaceID, - spaceDeletedID, - spaceTemplateID, - spaceTemplateDeletedID, - workItemID, - workItemDeletedID, - workItemLinkID, - workItemLinkDeletedID, - workItemLinkTypeID, - workItemLinkTypeDeletedID, - workItemTypeID, - workItemTypeDeletedID, + areaDeletedID.String(), + areaID.String(), + commentDeletedID.String(), + commentID.String(), + iterDeletedID.String(), + iterID.String(), + labelDeletedID.String(), + labelID.String(), + spaceDeletedID.String(), + spaceID.String(), + spaceTemplateDeletedID.String(), + spaceTemplateID.String(), + workItemDeletedID.String(), + workItemID.String(), + workItemLinkDeletedID.String(), + workItemLinkID.String(), + workItemLinkTypeDeletedID.String(), + workItemLinkTypeID.String(), + workItemTypeDeletedID.String(), + workItemTypeID.String(), )) }) @@ -1517,45 +1517,35 @@ func testMigration111CascadingSoftDelete(t *testing.T) { exists := func(t *testing.T, table string, id uuid.UUID) bool { q := fmt.Sprintf("SELECT 1 FROM %s WHERE id = '%s'", table, id) row := sqlDB.QueryRow(q) - require.NotNil(t, row) + require.NotNil(t, row, "exists table: %s, id: %s", table, id) var p int32 err := row.Scan(&p) - require.NoError(t, err, "%+v", err) + require.NoError(t, err, "exists table: %s, id: %s, err: %+v", table, id, err) return p == 1 } existsButIsDeleted := func(t *testing.T, table string, id uuid.UUID) bool { q := fmt.Sprintf("SELECT 1 FROM %s WHERE id = '%s' AND deleted_at IS NOT NULL", table, id) row := sqlDB.QueryRow(q) - require.NotNil(t, row) + require.NotNil(t, row, "existsButIsDeleted table: %s, id: %s", table, id) var p int32 err := row.Scan(&p) - require.NoError(t, err, "%+v", err) + require.NoError(t, err, "existsButIsDeleted table: %s, id: %s (comment: %s, comment (deleted): %s), err: %+v", table, id, areaID, areaDeletedID, err) return p == 1 } checkEntitiesExist := func(t *testing.T, existFunc func(t *testing.T, table string, id uuid.UUID) bool) { t.Run("check that all entities exist", func(t *testing.T) { - require.True(t, existFunc(t, "areas", areaID)) - require.True(t, existsButIsDeleted(t, "areas", areaDeletedID)) - require.True(t, existFunc(t, "work_item_comments", commentID)) - require.True(t, existsButIsDeleted(t, "work_item_comments", commentDeletedID)) - require.True(t, existFunc(t, "iterations", iterID)) - require.True(t, existsButIsDeleted(t, "iterations", iterDeletedID)) - require.True(t, existFunc(t, "labels", labelID)) - require.True(t, existsButIsDeleted(t, "labels", labelDeletedID)) - require.True(t, existFunc(t, "spaces", spaceID)) - require.True(t, existsButIsDeleted(t, "spaces", spaceDeletedID)) - require.True(t, existFunc(t, "space_templates", spaceTemplateID)) - require.True(t, existsButIsDeleted(t, "space_templates", spaceTemplateDeletedID)) - require.True(t, existFunc(t, "work_items", workItemID)) - require.True(t, existsButIsDeleted(t, "work_items", workItemDeletedID)) - require.True(t, existFunc(t, "work_item_links", workItemLinkID)) - require.True(t, existsButIsDeleted(t, "work_item_links", workItemLinkDeletedID)) - require.True(t, existFunc(t, "work_item_link_types", workItemLinkTypeID)) - require.True(t, existsButIsDeleted(t, "work_item_link_types", workItemLinkTypeDeletedID)) - require.True(t, existFunc(t, "work_item_types", workItemTypeID)) - require.True(t, existsButIsDeleted(t, "work_item_types", workItemTypeDeletedID)) + // require.True(t, existFunc(t, "areas", areaID), "area missing: %s", areaID) + // require.True(t, existFunc(t, "comments", commentID), "comment missing: %s", commentID) + // require.True(t, existFunc(t, "iterations", iterID), "iteration missing: %s", iterID) + // require.True(t, existFunc(t, "labels", labelID), "label missing: %s", labelID) + require.True(t, existFunc(t, "spaces", spaceID), "space missing: %s", spaceID) + require.True(t, existFunc(t, "space_templates", spaceTemplateID), "space template missing: %s", spaceTemplateID) + // require.True(t, existFunc(t, "work_items", workItemID), "work item missing: %s", workItemID) + // require.True(t, existFunc(t, "work_item_links", workItemLinkID), "work item link missing: %s", workItemLinkID) + // require.True(t, existFunc(t, "work_item_link_types", workItemLinkTypeID), "work item link type missing: %s", workItemLinkTypeID) + // require.True(t, existFunc(t, "work_item_types", workItemTypeID), "work item type missing: %s", workItemTypeID) }) - }) + } t.Run("before migration", func(t *testing.T) { checkEntitiesExist(t, exists) @@ -1565,7 +1555,7 @@ func testMigration111CascadingSoftDelete(t *testing.T) { }) t.Run("after migration", func(t *testing.T) { checkEntitiesExist(t, exists) - require.Nil(t, runSQLscript(sqlDB, "111-soft-delete-space-template.sql", spaceTemplateID)) + require.Nil(t, runSQLscript(sqlDB, "111-soft-delete-space-template.sql", spaceTemplateID.String())) checkEntitiesExist(t, existsButIsDeleted) }) diff --git a/migration/sql-files/111-cascading-soft-delete.sql b/migration/sql-files/111-cascading-soft-delete.sql index 64b51c4629..495cee4da8 100644 --- a/migration/sql-files/111-cascading-soft-delete.sql +++ b/migration/sql-files/111-cascading-soft-delete.sql @@ -1,3 +1,6 @@ +-- Add missing foreign key constraint from comment to work item +-- ALTER TABLE comments ADD FOREIGN KEY (parent_id) REFERENCES work_items(id) ON DELETE CASCADE; + CREATE OR REPLACE FUNCTION archive_record() -- archive_record() can be use used as the trigger function on all tables -- that want to archive their data into a separate *_archive table after @@ -53,37 +56,39 @@ END; $$ LANGUAGE plpgsql; -- Create archive tables -CREATE TABLE areas_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (areas); -CREATE TABLE comments_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (comments); -CREATE TABLE iterations_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (iterations); -CREATE TABLE labels_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (lables); +-- CREATE TABLE areas_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (areas); +-- CREATE TABLE comments_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (comments); +-- CREATE TABLE iterations_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (iterations); +-- CREATE TABLE labels_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (labels); CREATE TABLE space_templates_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (space_templates); CREATE TABLE spaces_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (spaces); -CREATE TABLE work_item_link_types_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_item_link_types); -CREATE TABLE work_item_links_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_item_links); -CREATE TABLE work_item_types_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_item_types); -CREATE TABLE work_items_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_items); +-- CREATE TABLE work_item_link_types_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_item_link_types); +-- CREATE TABLE work_item_links_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_item_links); +-- CREATE TABLE work_item_types_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_item_types); +-- CREATE TABLE work_items_archive (CHECK (deleted_at IS NOT NULL)) INHERITS (work_items); -- Setup triggers -CREATE TRIGGER archive_areas AFTER UPDATE OF deleted_at OR DELETE ON areas FOR EACH ROW EXECUTE PROCEDURE archive_record(); -CREATE TRIGGER archive_comments AFTER UPDATE OF deleted_at OR DELETE ON comments FOR EACH ROW EXECUTE PROCEDURE archive_record(); -CREATE TRIGGER archive_iterations AFTER UPDATE OF deleted_at OR DELETE ON iterations FOR EACH ROW EXECUTE PROCEDURE archive_record(); -CREATE TRIGGER archive_labels AFTER UPDATE OF deleted_at OR DELETE ON labels FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_areas AFTER UPDATE OF deleted_at OR DELETE ON areas FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_comments AFTER UPDATE OF deleted_at OR DELETE ON comments FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_iterations AFTER UPDATE OF deleted_at OR DELETE ON iterations FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_labels AFTER UPDATE OF deleted_at OR DELETE ON labels FOR EACH ROW EXECUTE PROCEDURE archive_record(); CREATE TRIGGER archive_space_templates AFTER UPDATE OF deleted_at OR DELETE ON space_templates FOR EACH ROW EXECUTE PROCEDURE archive_record(); CREATE TRIGGER archive_spaces AFTER UPDATE OF deleted_at OR DELETE ON spaces FOR EACH ROW EXECUTE PROCEDURE archive_record(); -CREATE TRIGGER archive_work_item_link_types AFTER UPDATE OF deleted_at OR DELETE ON work_item_link_types FOR EACH ROW EXECUTE PROCEDURE archive_record(); -CREATE TRIGGER archive_work_item_links AFTER UPDATE OF deleted_at OR DELETE ON work_item_links FOR EACH ROW EXECUTE PROCEDURE archive_record(); -CREATE TRIGGER archive_work_item_types AFTER UPDATE OF deleted_at OR DELETE ON work_item_types FOR EACH ROW EXECUTE PROCEDURE archive_record(); -CREATE TRIGGER archive_work_items AFTER UPDATE OF deleted_at OR DELETE ON work_items FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_work_item_link_types AFTER UPDATE OF deleted_at OR DELETE ON work_item_link_types FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_work_item_links AFTER UPDATE OF deleted_at OR DELETE ON work_item_links FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_work_item_types AFTER UPDATE OF deleted_at OR DELETE ON work_item_types FOR EACH ROW EXECUTE PROCEDURE archive_record(); +-- CREATE TRIGGER archive_work_items AFTER UPDATE OF deleted_at OR DELETE ON work_items FOR EACH ROW EXECUTE PROCEDURE archive_record(); + + -- Archive all deleted records -DELETE FROM areas WHERE deleted_at IS NOT NULL; -DELETE FROM comments WHERE deleted_at IS NOT NULL; -DELETE FROM iterations WHERE deleted_at IS NOT NULL; -DELETE FROM labels WHERE deleted_at IS NOT NULL; +-- DELETE FROM areas WHERE deleted_at IS NOT NULL; +-- DELETE FROM comments WHERE deleted_at IS NOT NULL; +-- DELETE FROM iterations WHERE deleted_at IS NOT NULL; +-- DELETE FROM labels WHERE deleted_at IS NOT NULL; DELETE FROM space_templates WHERE deleted_at IS NOT NULL; DELETE FROM spaces WHERE deleted_at IS NOT NULL; -DELETE FROM work_item_link_types WHERE deleted_at IS NOT NULL; -DELETE FROM work_item_links WHERE deleted_at IS NOT NULL; -DELETE FROM work_item_types WHERE deleted_at IS NOT NULL; -DELETE FROM work_items WHERE deleted_at IS NOT NULL; \ No newline at end of file +-- DELETE FROM work_item_link_types WHERE deleted_at IS NOT NULL; +-- DELETE FROM work_item_links WHERE deleted_at IS NOT NULL; +-- DELETE FROM work_item_types WHERE deleted_at IS NOT NULL; +-- DELETE FROM work_items WHERE deleted_at IS NOT NULL; \ No newline at end of file diff --git a/migration/sql-test-files/111-cascading-soft-delete-update.sql b/migration/sql-test-files/111-cascading-soft-delete-update.sql deleted file mode 100644 index a808159a61..0000000000 --- a/migration/sql-test-files/111-cascading-soft-delete-update.sql +++ /dev/null @@ -1,56 +0,0 @@ -SET id.area = '{{index . 0}}'; -SET id.areaDeleted = '{{index . 1}}'; -SET id.comment = '{{index . 2}}'; -SET id.commentDeleted = '{{index . 3}}'; -SET id.iter = '{{index . 4}}'; -SET id.iterDeleted = '{{index . 5}}'; -SET id.label = '{{index . 6}}'; -SET id.labelDeleted = '{{index . 7}}'; -SET id.space = '{{index . 8}}'; -SET id.spaceDeleted = '{{index . 9}}'; -SET id.spaceTemplate = '{{index . 10}}'; -SET id.spaceTemplateDeleted = '{{index . 11}}'; -SET id.workItem = '{{index . 12}}'; -SET id.workItemDeleted = '{{index . 13}}'; -SET id.workItemLink = '{{index . 14}}'; -SET id.workItemLinkDeleted = '{{index . 15}}'; -SET id.workItemLinkType = '{{index . 16}}'; -SET id.workItemLinkTypeDeleted = '{{index . 17}}'; -SET id.workItemType = '{{index . 18}}'; -SET id.workItemTypeDeleted = '{{index . 19}}'; - -INSERT INTO space_templates (id,name,description, deleted_at) VALUES - (current_setting('id.spaceTemplate')::uuid, current_setting('id.spaceTemplate'), 'test template', NULL), - (current_setting('id.spaceTemplateDeleted')::uuid, current_setting('id.spaceTemplateDeleted'), 'test template', '2018-09-17 16:01'); - -INSERT INTO spaces (id,name,space_template_id, deleted_at) VALUES - (current_setting('id.space')::uuid, current_setting('id.space'), current_setting('id.spaceTemplate')::uuid, NULL), - (current_setting('id.spaceDeleted')::uuid, current_setting('id.spaceDeleted'), current_setting('id.spaceTemplate')::uuid, '2018-09-17 16:01'); - -INSERT INTO iterations (id, name, path, space_id, deleted_at) VALUES - (current_setting('id.iterRoot')::uuid, 'root iteration', replace(current_setting('id.iter'), '-', '_')::ltree, current_setting('id.space')::uuid, NULL), - (current_setting('id.iterDeleted')::uuid, 'deleted iteration', replace(current_setting('id.iterDeleted'), '-', '_')::ltree, current_setting('id.space')::uuid, '2018-09-17 16:01'); - -INSERT INTO areas (id, name, path, space_id, deleted_at) VALUES - (current_setting('id.area')::uuid, 'area', replace(current_setting('id.area'), '-', '_')::ltree, current_setting('id.space')::uuid, NULL), - (current_setting('id.areaDeleted')::uuid, 'area deleted', replace(current_setting('id.areaDeleted'), '-', '_')::ltree, current_setting('id.space')::uuid, '2018-09-17 16:01'); - -INSERT INTO labels (id, name, text_color, background_color, space_id, deleted_at) VALUES - (current_setting('id.label')::uuid, 'some label', '#ffffff', '#000000', current_setting('id.space')::uuid, NULL), - (current_setting('id.labelDeleted')::uuid, 'deleted label', '#000000', '#ffffff', current_setting('id.space')::uuid, '2018-09-17 16:01'), - -INSERT INTO work_item_types (id, name, space_template_id, fields, description, icon, deleted_at) VALUES - (current_setting('id.workItemType')::uuid, 'WIT1', current_setting('id.spaceTemplate')::uuid, '{"system.title": {"Type": {"Kind": "string"}, "Label": "Title", "Required": true, "Description": "The title text of the work item"}}', 'Description for WIT1', 'fa fa-bookmark', NULL), - (current_setting('id.workItemTypeDeleted')::uuid, 'WIT2 Deleted', current_setting('id.spaceTemplate')::uuid, '{"system.title": {"Type": {"Kind": "string"}, "Label": "Title", "Required": true, "Description": "The title text of the work item"}}', 'Description for WIT2 Deleted', 'fa fa-bookmark', '2018-09-17 16:01'); - -INSERT INTO work_items (id, type, space_id, fields, deleted_at) VALUES - (current_setting('id.workItem')::uuid, current_setting('id.workItemType')::uuid, current_setting('id.space')::uuid, '{"system.title":"Work item 1"}'::json, NULL), - (current_setting('id.workItemDeleted')::uuid, current_setting('id.workItemType')::uuid, current_setting('id.space')::uuid, '{"system.title":"Work item 2 Deleted"}'::json, '2018-09-17 16:01'); - -INSERT INTO comments (id, parent_id, body, deleted_at) VALUES - (current_setting('id.comment')::uuid, current_setting('id.workItem')::uuid, 'a comment', NULL), - (current_setting('id.commentDeleted')::uuid, current_setting('id.workItem')::uuid, 'another comment', '2018-09-17 16:01'); - -INSERT INTO work_item_link_types (id, name, forward_name, reverse_name, topology, space_template_id, deleted_at) VALUES - (current_setting('id.workItemLinkType')::uuid, 'Bug blocker', 'blocks', 'blocked by', 'network', current_setting('id.spaceTemplate')::uuid, NULL), - (current_setting('id.workItemLinkTypeDeleted')::uuid, 'Dependency', 'depends on', 'is dependent on', 'dependency', current_setting('id.spaceTemplate')::uuid, '2018-09-17 16:01'); \ No newline at end of file diff --git a/migration/sql-test-files/111-cascading-soft-delete.sql b/migration/sql-test-files/111-cascading-soft-delete.sql new file mode 100644 index 0000000000..f204420206 --- /dev/null +++ b/migration/sql-test-files/111-cascading-soft-delete.sql @@ -0,0 +1,60 @@ +SET id.areaDeleted = '{{index . 0}}'; +SET id.area = '{{index . 1}}'; +SET id.commentDeleted = '{{index . 2}}'; +SET id.comment = '{{index . 3}}'; +SET id.iterDeleted = '{{index . 4}}'; +SET id.iter = '{{index . 5}}'; +SET id.labelDeleted = '{{index . 6}}'; +SET id.label = '{{index . 7}}'; +SET id.spaceDeleted = '{{index . 8}}'; +SET id.space = '{{index . 9}}'; +SET id.spaceTemplateDeleted = '{{index . 10}}'; +SET id.spaceTemplate = '{{index . 11}}'; +SET id.workItemDeleted = '{{index . 12}}'; +SET id.workItem = '{{index . 13}}'; +SET id.workItemLinkDeleted = '{{index . 14}}'; +SET id.workItemLink = '{{index . 15}}'; +SET id.workItemLinkTypeDeleted = '{{index . 16}}'; +SET id.workItemLinkType = '{{index . 17}}'; +SET id.workItemTypeDeleted = '{{index . 18}}'; +SET id.workItemType = '{{index . 19}}'; + +INSERT INTO space_templates (id,name,description, deleted_at) VALUES + (current_setting('id.spaceTemplate')::uuid, current_setting('id.spaceTemplate'), 'test template', NULL), + (current_setting('id.spaceTemplateDeleted')::uuid, current_setting('id.spaceTemplateDeleted'), 'test template', '2018-09-17 16:01'); + +INSERT INTO spaces (id,name,space_template_id, deleted_at) VALUES + (current_setting('id.space')::uuid, current_setting('id.space'), current_setting('id.spaceTemplate')::uuid, NULL), + (current_setting('id.spaceDeleted')::uuid, current_setting('id.spaceDeleted'), current_setting('id.spaceTemplate')::uuid, '2018-09-17 16:01'); + +-- INSERT INTO iterations (id, name, path, space_id, number, deleted_at) VALUES +-- (current_setting('id.iter')::uuid, 'root iteration', replace(current_setting('id.iter'), '-', '_')::ltree, current_setting('id.space')::uuid, 1, NULL), +-- (current_setting('id.iterDeleted')::uuid, 'deleted iteration', replace(current_setting('id.iterDeleted'), '-', '_')::ltree, current_setting('id.space')::uuid, 2, '2018-09-17 16:01'); + +-- INSERT INTO areas (id, name, path, space_id, number, deleted_at) VALUES +-- (current_setting('id.area')::uuid, 'area', replace(current_setting('id.area'), '-', '_')::ltree, current_setting('id.space')::uuid, 1, NULL), +-- (current_setting('id.areaDeleted')::uuid, 'area deleted', replace(current_setting('id.areaDeleted'), '-', '_')::ltree, current_setting('id.space')::uuid, 2, '2018-09-17 16:01'); + +-- INSERT INTO labels (id, name, text_color, background_color, space_id, deleted_at) VALUES +-- (current_setting('id.label')::uuid, 'some label', '#ffffff', '#000000', current_setting('id.space')::uuid, NULL), +-- (current_setting('id.labelDeleted')::uuid, 'deleted label', '#000000', '#ffffff', current_setting('id.space')::uuid, '2018-09-17 16:01'); + +-- INSERT INTO work_item_types (id, name, space_template_id, fields, description, icon, deleted_at) VALUES +-- (current_setting('id.workItemType')::uuid, 'WIT1', current_setting('id.spaceTemplate')::uuid, '{"system.title": {"Type": {"Kind": "string"}, "Label": "Title", "Required": true, "Description": "The title text of the work item"}}', 'Description for WIT1', 'fa fa-bookmark', NULL), +-- (current_setting('id.workItemTypeDeleted')::uuid, 'WIT2 Deleted', current_setting('id.spaceTemplate')::uuid, '{"system.title": {"Type": {"Kind": "string"}, "Label": "Title", "Required": true, "Description": "The title text of the work item"}}', 'Description for WIT2 Deleted', 'fa fa-bookmark', '2018-09-17 16:01'); + +-- INSERT INTO work_items (id, type, space_id, fields, deleted_at) VALUES +-- (current_setting('id.workItem')::uuid, current_setting('id.workItemType')::uuid, current_setting('id.space')::uuid, '{"system.title":"Work item 1"}'::json, NULL), +-- (current_setting('id.workItemDeleted')::uuid, current_setting('id.workItemType')::uuid, current_setting('id.space')::uuid, '{"system.title":"Work item 2 Deleted"}'::json, '2018-09-17 16:01'); + +-- INSERT INTO work_item_link_types (id, name, forward_name, reverse_name, topology, space_template_id, deleted_at) VALUES +-- (current_setting('id.workItemLinkType')::uuid, 'Bug blocker', 'blocks', 'blocked by', 'network', current_setting('id.spaceTemplate')::uuid, NULL), +-- (current_setting('id.workItemLinkTypeDeleted')::uuid, 'Dependency', 'depends on', 'is dependent on', 'dependency', current_setting('id.spaceTemplate')::uuid, '2018-09-17 16:01'); + +-- INSERT INTO work_item_links (id, link_type_id, source_id, target_id, deleted_at) VALUES +-- (current_setting('id.workItemLink')::uuid, current_setting('id.workItemLinkType')::uuid, current_setting('id.workItem')::uuid, current_setting('id.workItem')::uuid, NULL), +-- (current_setting('id.workItemLinkDeleted')::uuid, current_setting('id.workItemLinkType')::uuid, current_setting('id.workItem')::uuid, current_setting('id.workItem')::uuid, '2018-09-17 16:01'); + +-- INSERT INTO comments (id, parent_id, body, deleted_at) VALUES +-- (current_setting('id.comment')::uuid, current_setting('id.workItem')::uuid, 'a comment', NULL), +-- (current_setting('id.commentDeleted')::uuid, current_setting('id.workItem')::uuid, 'another comment', '2018-09-17 16:01'); \ No newline at end of file