From 8f204b748a0f2e1226fbc906b1e46d40f58a1053 Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Wed, 2 Nov 2022 18:47:18 -0700 Subject: [PATCH 1/8] Adds QA models --- canonical-schema/V010__create_qa.sql | 208 +++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 canonical-schema/V010__create_qa.sql diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql new file mode 100644 index 00000000..907514c7 --- /dev/null +++ b/canonical-schema/V010__create_qa.sql @@ -0,0 +1,208 @@ +-- qa models -- +create table + "qa_CodeQuality"( + id text generated always as(pkey("uid":: text)) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "uid" text not null, + "bugs" jsonb, + "branchCoverage" jsonb, + "codeSmells" jsonb, + "complexity" jsonb, + "coverage" jsonb, + "duplications" jsonb, + "duplicatedBlocks" jsonb, + "lineCoverage" jsonb, + "securityHotspots" jsonb, + "vulnerabilities" jsonb, + "createdAt" timestamptz, + "pullRequest" text, + "repository" text + ); +create table + "qa_TestCase"( + id text generated always as( + pkey("source":: text, "uid":: text) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "uid" text not null, + "name" text, + "description" text, + "source" text, + "before" jsonb, + "after" jsonb, + "tags" jsonb, + "type" jsonb, + "task" text + ); +create table + "qa_TestCaseResult"( + id text generated always as( + pkey( + "testExecution":: text, + "uid":: text + ) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "uid" text not null, + "description" text, + "startedAt" timestamptz, + "endedAt" timestamptz, + "status" jsonb, + "testCase" text, + "testExecution" text + ); +create table + "qa_TestCaseStep"( + id text generated always as( + pkey( + "testCase":: text, + "uid":: text + ) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "uid" text not null, + "name" text, + "description" text, + "data" text, + "result" text, + "testCase" text + ); +create table + "qa_TestCaseStepResult"( + id text generated always as( + pkey( + "testResult":: text, + "uid":: text + ) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "uid" text not null, + "status" jsonb, + "testStep" text, + "testResult" text + ); +create table + "qa_TestExecution"( + id text generated always as( + pkey("source":: text, "uid":: text) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "uid" text not null, + "name" text, + "description" text, + "source" text, + "startedAt" timestamptz, + "endedAt" timestamptz, + "status" jsonb, + "environments" jsonb, + "testCaseResultsStats" jsonb, + "deviceInfo" jsonb, + "tags" jsonb, + "suite" text, + "task" text, + "build" text + ); +create table + "qa_TestExecutionCommitAssociation"( + id text generated always as( + pkey( + "commit":: text, + "testExecution":: text + ) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "testExecution" text, + "commit" text + ); +create table + "qa_TestSuite"( + id text generated always as( + pkey("source":: text, "uid":: text) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "uid" text not null, + "name" text, + "description" text, + "source" text, + "tags" jsonb, + "type" jsonb, + "task" text + ); +create table + "qa_TestSuiteTestCaseAssociation"( + id text generated always as( + pkey( + "testCase":: text, + "testSuite":: text + ) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "testSuite" text, + "testCase" text + ); + +-- foreign keys -- +alter table "qa_CodeQuality" add foreign key ("pullRequest") references "vcs_PullRequest"(id); +alter table "qa_CodeQuality" add foreign key ("repository") references "vcs_Repository"(id); +alter table "qa_TestCase" add foreign key ("task") references "tms_Task"(id); +alter table "qa_TestCaseResult" add foreign key ("testCase") references "qa_TestCase"(id); +alter table "qa_TestCaseResult" add foreign key ("testExecution") references "qa_TestExecution"(id); +alter table "qa_TestCaseStep" add foreign key ("testCase") references "qa_TestCase"(id); +alter table "qa_TestCaseStepResult" add foreign key ("testStep") references "qa_TestCaseStep"(id); +alter table "qa_TestCaseStepResult" add foreign key ("testResult") references "qa_TestCaseResult"(id); +alter table "qa_TestExecution" add foreign key ("suite") references "qa_TestSuite"(id); +alter table "qa_TestExecution" add foreign key ("task") references "tms_Task"(id); +alter table "qa_TestExecution" add foreign key ("build") references "cicd_Build"(id); +alter table "qa_TestExecutionCommitAssociation" add foreign key ("testExecution") references "qa_TestExecution"(id); +alter table "qa_TestExecutionCommitAssociation" add foreign key ("commit") references "vcs_Commit"(id); +alter table "qa_TestSuite" add foreign key ("task") references "tms_Task"(id); +alter table "qa_TestSuiteTestCaseAssociation" add foreign key ("testSuite") references "qa_TestSuite"(id); +alter table "qa_TestSuiteTestCaseAssociation" add foreign key ("testCase") references "qa_TestCase"(id); + +-- indices -- +create index "qa_CodeQuality_origin_idx" on "qa_CodeQuality"("origin"); +create index "qa_CodeQuality_uid_idx" on "qa_CodeQuality"("uid"); +create index "qa_CodeQuality_createdAt_idx" on "qa_CodeQuality"("createdAt"); +create index "qa_CodeQuality_pull_request_idx" on "qa_CodeQuality"("pullRequest"); +create index "qa_CodeQuality_repository_idx" on "qa_CodeQuality"("repository"); +create index "qa_TestCase_origin_idx" on "qa_TestCase"("origin"); +create index "qa_TestCase_uid_idx" on "qa_TestCase"("uid"); +create index "qa_TestCase_task_idx" on "qa_TestCase"("task"); +create index "qa_TestCaseResult_origin_idx" on "qa_TestCaseResult"("origin"); +create index "qa_TestCaseResult_uid_idx" on "qa_TestCaseResult"("uid"); +create index "qa_TestCaseResult_startedAt_idx" on "qa_TestCaseResult"("startedAt"); +create index "qa_TestCaseResult_endedAt_idx" on "qa_TestCaseResult"("endedAt"); +create index "qa_TestCaseResult_testCase_idx" on "qa_TestCaseResult"("testCase"); +create index "qa_TestCaseResult_testExecution_idx" on "qa_TestCaseResult"("testExecution"); +create index "qa_TestCaseStep_origin_idx" on "qa_TestCaseStep"("origin"); +create index "qa_TestCaseStep_uid_idx" on "qa_TestCaseStep"("uid"); +create index "qa_TestCaseStep_testCase_idx" on "qa_TestCaseStep"("testCase"); +create index "qa_TestCaseStepResult_origin_idx" on "qa_TestCaseStepResult"("origin"); +create index "qa_TestCaseStepResult_uid_idx" on "qa_TestCaseStepResult"("uid"); +create index "qa_TestCaseStepResult_testStep_idx" on "qa_TestCaseStepResult"("testStep"); +create index "qa_TestCaseStepResult_testResult_idx" on "qa_TestCaseStepResult"("testResult"); +create index "qa_TestExecution_origin_idx" on "qa_TestExecution"("origin"); +create index "qa_TestExecution_uid_idx" on "qa_TestExecution"("uid"); +create index "qa_TestExecution_startedAt_idx" on "qa_TestExecution"("startedAt"); +create index "qa_TestExecution_endedAt_idx" on "qa_TestExecution"("endedAt"); +create index "qa_TestExecution_suite_idx" on "qa_TestExecution"("suite"); +create index "qa_TestExecution_task_idx" on "qa_TestExecution"("task"); +create index "qa_TestExecution_build_idx" on "qa_TestExecution"("build"); +create index "qa_TestExecutionCommitAssociation_origin_idx" on "qa_TestExecutionCommitAssociation"("origin"); +create index "qa_TestExecutionCommitAssociation_testExecution_idx" on "qa_TestExecutionCommitAssociation"("testExecution"); +create index "qa_TestExecutionCommitAssociation_commit_idx" on "qa_TestExecutionCommitAssociation"("commit"); +create index "qa_TestSuite_origin_idx" on "qa_TestSuite"("origin"); +create index "qa_TestSuite_uid_idx" on "qa_TestSuite"("uid"); +create index "qa_TestSuite_task_idx" on "qa_TestSuite"("task"); +create index "qa_TestSuiteTestCaseAssociation_origin_idx" on "qa_TestSuiteTestCaseAssociation"("origin"); +create index "qa_TestSuiteTestCaseAssociation_testSuite_idx" on "qa_TestSuiteTestCaseAssociation"("testSuite"); +create index "qa_TestSuiteTestCaseAssociation_testCase_idx" on "qa_TestSuiteTestCaseAssociation"("testCase"); From 48b8951da2dbe64fd3223abdfd9897f1f7840ef3 Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Thu, 3 Nov 2022 21:44:18 -0700 Subject: [PATCH 2/8] QA models jsonb expansion --- canonical-schema/V010__create_qa.sql | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql index 907514c7..0d75f5e9 100644 --- a/canonical-schema/V010__create_qa.sql +++ b/canonical-schema/V010__create_qa.sql @@ -206,3 +206,72 @@ create index "qa_TestSuite_task_idx" on "qa_TestSuite"("task"); create index "qa_TestSuiteTestCaseAssociation_origin_idx" on "qa_TestSuiteTestCaseAssociation"("origin"); create index "qa_TestSuiteTestCaseAssociation_testSuite_idx" on "qa_TestSuiteTestCaseAssociation"("testSuite"); create index "qa_TestSuiteTestCaseAssociation_testCase_idx" on "qa_TestSuiteTestCaseAssociation"("testCase"); + +-- expansion -- +alter table "qa_CodeQuality" add column "bugsValue" text generated always as(("bugs" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "branchCoverageValue" text generated always as(("branchCoverage" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "codeSmellsValue" text generated always as(("codeSmells" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "complexityValue" text generated always as(("complexity" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "coverageValue" text generated always as(("coverage" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "duplicationsValue" text generated always as(("duplications" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "duplicatedBlocksValue" text generated always as(("duplicatedBlocks" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "lineCoverageValue" text generated always as(("lineCoverage" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "securityHotspotsValue" text generated always as(("securityHotspots" ->> 'value'):: text) stored; +alter table "qa_CodeQuality" add column "vulnerabilitiesValue" text generated always as(("vulnerabilities" ->> 'value'):: text) stored; +alter table "qa_TestCase" add column "beforeDescription" text generated always as(("before" ->> 'description'):: text) stored; +alter table "qa_TestCase" add column "beforeCondition" text generated always as(("before" ->> 'condition'):: text) stored; +alter table "qa_TestCase" add column "afterDescription" text generated always as(("after" ->> 'description'):: text) stored; +alter table "qa_TestCase" add column "afterCondition" text generated always as(("after" ->> 'condition'):: text) stored; +alter table "qa_TestCase" add column "typeCategory" text generated always as(("type" ->> 'category'):: text) stored; +alter table "qa_TestCase" add column "typeDetail" text generated always as(("type" ->> 'detail'):: text) stored; +alter table "qa_TestCase" add column "typeCategory" text generated always as(("type" ->> 'category'):: text) stored; +alter table "qa_TestCase" add column "typeDetail" text generated always as(("type" ->> 'detail'):: text) stored; +alter table "qa_TestCaseResult" add column "statusCategory" text generated always as(("status" ->> 'category'):: text) stored; +alter table "qa_TestCaseResult" add column "statusDetail" text generated always as(("status" ->> 'detail'):: text) stored; +alter table "qa_TestCaseStepResult" add column "statusCategory" text generated always as(("status" ->> 'category'):: text) stored; +alter table "qa_TestCaseStepResult" add column "statusDetail" text generated always as(("status" ->> 'detail'):: text) stored; +alter table "qa_TestExecution" add column "statusCategory" text generated always as(("status" ->> 'category'):: text) stored; +alter table "qa_TestExecution" add column "statusDetail" text generated always as(("status" ->> 'detail'):: text) stored; +alter table "qa_TestExecution" add column "testCaseResultsStatsFailure" integer generated always as (("testCaseResultsStats" -> 'failure')::integer) stored; +alter table "qa_TestExecution" add column "testCaseResultsStatsSuccess" integer generated always as (("testCaseResultsStats" -> 'success')::integer) stored; +alter table "qa_TestExecution" add column "testCaseResultsStatsSkipped" integer generated always as (("testCaseResultsStats" -> 'skipped')::integer) stored; +alter table "qa_TestExecution" add column "testCaseResultsStatsUnknown" integer generated always as (("testCaseResultsStats" -> 'unknown')::integer) stored; +alter table "qa_TestExecution" add column "testCaseResultsStatsCustom" integer generated always as (("testCaseResultsStats" -> 'custom')::integer) stored; +alter table "qa_TestExecution" add column "testCaseResultsStatsTotal" integer generated always as (("testCaseResultsStats" -> 'total')::integer) stored; +alter table "qa_TestExecution" add column "deviceInfoName" text generated always as (("deviceInfo" -> 'name')::text) stored; +alter table "qa_TestExecution" add column "deviceInfoOs" text generated always as (("deviceInfo" -> 'os')::text) stored; +alter table "qa_TestExecution" add column "deviceInfoBrowser" text generated always as (("deviceInfo" -> 'browser')::text) stored; +alter table "qa_TestExecution" add column "deviceInfoType" text generated always as (("deviceInfo" -> 'type')::text) stored; +alter table "qa_TestSuite" add column "typeCategory" text generated always as(("type" ->> 'category'):: text) stored; +alter table "qa_TestSuite" add column "typeDetail" text generated always as(("type" ->> 'detail'):: text) stored; + +comment on column "qa_CodeQuality"."bugsValue" is 'generated'; +comment on column "qa_CodeQuality"."branchCoverageValue" is 'generated'; +comment on column "qa_CodeQuality"."codeSmellsValue" is 'generated'; +comment on column "qa_CodeQuality"."complexityValue" is 'generated'; +comment on column "qa_CodeQuality"."coverageValue" is 'generated'; +comment on column "qa_CodeQuality"."duplicationsValue" is 'generated'; +comment on column "qa_CodeQuality"."duplicatedBlocksValue" is 'generated'; +comment on column "qa_CodeQuality"."lineCoverageValue" is 'generated'; +comment on column "qa_CodeQuality"."securityHotspotsValue" is 'generated'; +comment on column "qa_CodeQuality"."vulnerabilitiesValue" is 'generated'; +comment on column "qa_TestCase"."typeCategory" is 'generated'; +comment on column "qa_TestCase"."typeDetail" is 'generated'; +comment on column "qa_TestCaseResult"."statusCategory" is 'generated'; +comment on column "qa_TestCaseResult"."statusDetail" is 'generated'; +comment on column "qa_TestCaseStepResult"."statusCategory" is 'generated'; +comment on column "qa_TestCaseStepResult"."statusDetail" is 'generated'; +comment on column "qa_TestExecution"."statusCategory" is 'generated'; +comment on column "qa_TestExecution"."statusDetail" is 'generated'; +comment on column "qa_TestExecution"."testCaseResultsStatsFailure" is 'generated'; +comment on column "qa_TestExecution"."testCaseResultsStatsSuccess" is 'generated'; +comment on column "qa_TestExecution"."testCaseResultsStatsSkipped" is 'generated'; +comment on column "qa_TestExecution"."testCaseResultsStatsUnknown" is 'generated'; +comment on column "qa_TestExecution"."testCaseResultsStatsCustom" is 'generated'; +comment on column "qa_TestExecution"."testCaseResultsStatsTotal" is 'generated'; +comment on column "qa_TestExecution"."deviceInfoName" is 'generated'; +comment on column "qa_TestExecution"."deviceInfoOs" is 'generated'; +comment on column "qa_TestExecution"."deviceInfoBrowser" is 'generated'; +comment on column "qa_TestExecution"."deviceInfoType" is 'generated'; +comment on column "qa_TestSuite"."typeCategory" is 'generated'; +comment on column "qa_TestSuite"."typeDetail" is 'generated'; From de030ea071cf8bb029d6e8215a66d19ad18ff023 Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Thu, 3 Nov 2022 21:56:57 -0700 Subject: [PATCH 3/8] Adds tms_TaskTestCaseResultAssociation --- canonical-schema/V010__create_qa.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql index 0d75f5e9..4fd722a2 100644 --- a/canonical-schema/V010__create_qa.sql +++ b/canonical-schema/V010__create_qa.sql @@ -149,6 +149,19 @@ create table "testSuite" text, "testCase" text ); + create table + "tms_TaskTestCaseResultAssociation"( + id text generated always as( + pkey( + "defect":: text, + "testCaseResult":: text + ) + ) stored primary key, + origin text, + "refreshedAt" timestamptz not null default now(), + "defect" text, + "testCaseResult" text + ); -- foreign keys -- alter table "qa_CodeQuality" add foreign key ("pullRequest") references "vcs_PullRequest"(id); @@ -167,6 +180,8 @@ alter table "qa_TestExecutionCommitAssociation" add foreign key ("commit") refer alter table "qa_TestSuite" add foreign key ("task") references "tms_Task"(id); alter table "qa_TestSuiteTestCaseAssociation" add foreign key ("testSuite") references "qa_TestSuite"(id); alter table "qa_TestSuiteTestCaseAssociation" add foreign key ("testCase") references "qa_TestCase"(id); +alter table "tms_TaskTestCaseResultAssociation" add foreign key ("defect") references "tms_Task"(id); +alter table "tms_TaskTestCaseResultAssociation" add foreign key ("testCaseResult") references "qa_TestCaseResult"(id); -- indices -- create index "qa_CodeQuality_origin_idx" on "qa_CodeQuality"("origin"); @@ -206,6 +221,8 @@ create index "qa_TestSuite_task_idx" on "qa_TestSuite"("task"); create index "qa_TestSuiteTestCaseAssociation_origin_idx" on "qa_TestSuiteTestCaseAssociation"("origin"); create index "qa_TestSuiteTestCaseAssociation_testSuite_idx" on "qa_TestSuiteTestCaseAssociation"("testSuite"); create index "qa_TestSuiteTestCaseAssociation_testCase_idx" on "qa_TestSuiteTestCaseAssociation"("testCase"); +create index "tms_TaskTestCaseResultAssociation_defect_idx" on "tms_TaskTestCaseResultAssociation"("defect"); +create index "tms_TaskTestCaseResultAssociation_testCaseResult_idx" on "tms_TaskTestCaseResultAssociation"("testCaseResult"); -- expansion -- alter table "qa_CodeQuality" add column "bugsValue" text generated always as(("bugs" ->> 'value'):: text) stored; From e03b8fda33d13fcfb24bd18b5a01e0b4a7558692 Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Thu, 3 Nov 2022 22:10:57 -0700 Subject: [PATCH 4/8] Matches style with previous versions --- canonical-schema/V010__create_qa.sql | 160 ++++++++++----------------- 1 file changed, 57 insertions(+), 103 deletions(-) diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql index 4fd722a2..ce778547 100644 --- a/canonical-schema/V010__create_qa.sql +++ b/canonical-schema/V010__create_qa.sql @@ -1,10 +1,9 @@ -- qa models -- -create table - "qa_CodeQuality"( - id text generated always as(pkey("uid":: text)) stored primary key, +create table "qa_CodeQuality" ( + id text generated always as (pkey(uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "uid" text not null, + uid text not null, "bugs" jsonb, "branchCoverage" jsonb, "codeSmells" jsonb, @@ -19,14 +18,11 @@ create table "pullRequest" text, "repository" text ); -create table - "qa_TestCase"( - id text generated always as( - pkey("source":: text, "uid":: text) - ) stored primary key, +create table "qa_TestCase" ( + id text generated always as (pkey(source, uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "uid" text not null, + uid text not null, "name" text, "description" text, "source" text, @@ -36,17 +32,11 @@ create table "type" jsonb, "task" text ); -create table - "qa_TestCaseResult"( - id text generated always as( - pkey( - "testExecution":: text, - "uid":: text - ) - ) stored primary key, +create table"qa_TestCaseResult" ( + id text generated always as (pkey("testExecution", uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "uid" text not null, + uid text not null, "description" text, "startedAt" timestamptz, "endedAt" timestamptz, @@ -54,46 +44,31 @@ create table "testCase" text, "testExecution" text ); -create table - "qa_TestCaseStep"( - id text generated always as( - pkey( - "testCase":: text, - "uid":: text - ) - ) stored primary key, +create table "qa_TestCaseStep" ( + id text generated always as (pkey("testCase", uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "uid" text not null, + uid text not null, "name" text, "description" text, "data" text, "result" text, "testCase" text ); -create table - "qa_TestCaseStepResult"( - id text generated always as( - pkey( - "testResult":: text, - "uid":: text - ) - ) stored primary key, +create table "qa_TestCaseStepResult" ( + id text generated always as (pkey("testResult", uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "uid" text not null, + uid text not null, "status" jsonb, "testStep" text, "testResult" text ); -create table - "qa_TestExecution"( - id text generated always as( - pkey("source":: text, "uid":: text) - ) stored primary key, +create table "qa_TestExecution" ( + id text generated always as (pkey("source", uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "uid" text not null, + uid text not null, "name" text, "description" text, "source" text, @@ -108,27 +83,18 @@ create table "task" text, "build" text ); -create table - "qa_TestExecutionCommitAssociation"( - id text generated always as( - pkey( - "commit":: text, - "testExecution":: text - ) - ) stored primary key, +create table "qa_TestExecutionCommitAssociation" ( + id text generated always as (pkey("commit", "testExecution")) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), "testExecution" text, "commit" text ); -create table - "qa_TestSuite"( - id text generated always as( - pkey("source":: text, "uid":: text) - ) stored primary key, +create table "qa_TestSuite" ( + id text generated always as (pkey("source", uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "uid" text not null, + uid text not null, "name" text, "description" text, "source" text, @@ -136,27 +102,15 @@ create table "type" jsonb, "task" text ); -create table - "qa_TestSuiteTestCaseAssociation"( - id text generated always as( - pkey( - "testCase":: text, - "testSuite":: text - ) - ) stored primary key, +create table "qa_TestSuiteTestCaseAssociation" ( + id text generated always as (pkey("testCase", "testSuite")) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), "testSuite" text, "testCase" text ); - create table - "tms_TaskTestCaseResultAssociation"( - id text generated always as( - pkey( - "defect":: text, - "testCaseResult":: text - ) - ) stored primary key, +create table "tms_TaskTestCaseResultAssociation" ( + id text generated always as (pkey("defect", "testCaseResult")) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), "defect" text, @@ -225,42 +179,42 @@ create index "tms_TaskTestCaseResultAssociation_defect_idx" on "tms_TaskTestCase create index "tms_TaskTestCaseResultAssociation_testCaseResult_idx" on "tms_TaskTestCaseResultAssociation"("testCaseResult"); -- expansion -- -alter table "qa_CodeQuality" add column "bugsValue" text generated always as(("bugs" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "branchCoverageValue" text generated always as(("branchCoverage" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "codeSmellsValue" text generated always as(("codeSmells" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "complexityValue" text generated always as(("complexity" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "coverageValue" text generated always as(("coverage" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "duplicationsValue" text generated always as(("duplications" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "duplicatedBlocksValue" text generated always as(("duplicatedBlocks" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "lineCoverageValue" text generated always as(("lineCoverage" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "securityHotspotsValue" text generated always as(("securityHotspots" ->> 'value'):: text) stored; -alter table "qa_CodeQuality" add column "vulnerabilitiesValue" text generated always as(("vulnerabilities" ->> 'value'):: text) stored; -alter table "qa_TestCase" add column "beforeDescription" text generated always as(("before" ->> 'description'):: text) stored; -alter table "qa_TestCase" add column "beforeCondition" text generated always as(("before" ->> 'condition'):: text) stored; -alter table "qa_TestCase" add column "afterDescription" text generated always as(("after" ->> 'description'):: text) stored; -alter table "qa_TestCase" add column "afterCondition" text generated always as(("after" ->> 'condition'):: text) stored; -alter table "qa_TestCase" add column "typeCategory" text generated always as(("type" ->> 'category'):: text) stored; -alter table "qa_TestCase" add column "typeDetail" text generated always as(("type" ->> 'detail'):: text) stored; -alter table "qa_TestCase" add column "typeCategory" text generated always as(("type" ->> 'category'):: text) stored; -alter table "qa_TestCase" add column "typeDetail" text generated always as(("type" ->> 'detail'):: text) stored; -alter table "qa_TestCaseResult" add column "statusCategory" text generated always as(("status" ->> 'category'):: text) stored; -alter table "qa_TestCaseResult" add column "statusDetail" text generated always as(("status" ->> 'detail'):: text) stored; -alter table "qa_TestCaseStepResult" add column "statusCategory" text generated always as(("status" ->> 'category'):: text) stored; -alter table "qa_TestCaseStepResult" add column "statusDetail" text generated always as(("status" ->> 'detail'):: text) stored; -alter table "qa_TestExecution" add column "statusCategory" text generated always as(("status" ->> 'category'):: text) stored; -alter table "qa_TestExecution" add column "statusDetail" text generated always as(("status" ->> 'detail'):: text) stored; +alter table "qa_CodeQuality" add column "bugsValue" text generated always as ("bugs" ->> 'value') stored; +alter table "qa_CodeQuality" add column "branchCoverageValue" text generated always as ("branchCoverage" ->> 'value') stored; +alter table "qa_CodeQuality" add column "codeSmellsValue" text generated always as ("codeSmells" ->> 'value') stored; +alter table "qa_CodeQuality" add column "complexityValue" text generated always as ("complexity" ->> 'value') stored; +alter table "qa_CodeQuality" add column "coverageValue" text generated always as ("coverage" ->> 'value') stored; +alter table "qa_CodeQuality" add column "duplicationsValue" text generated always as ("duplications" ->> 'value') stored; +alter table "qa_CodeQuality" add column "duplicatedBlocksValue" text generated always as ("duplicatedBlocks" ->> 'value') stored; +alter table "qa_CodeQuality" add column "lineCoverageValue" text generated always as ("lineCoverage" ->> 'value') stored; +alter table "qa_CodeQuality" add column "securityHotspotsValue" text generated always as ("securityHotspots" ->> 'value') stored; +alter table "qa_CodeQuality" add column "vulnerabilitiesValue" text generated always as ("vulnerabilities" ->> 'value') stored; +alter table "qa_TestCase" add column "beforeDescription" text generated always as ("before" ->> 'description') stored; +alter table "qa_TestCase" add column "beforeCondition" text generated always as ("before" ->> 'condition') stored; +alter table "qa_TestCase" add column "afterDescription" text generated always as ("after" ->> 'description') stored; +alter table "qa_TestCase" add column "afterCondition" text generated always as ("after" ->> 'condition') stored; +alter table "qa_TestCase" add column "typeCategory" text generated always as ("type" ->> 'category') stored; +alter table "qa_TestCase" add column "typeDetail" text generated always as ("type" ->> 'detail') stored; +alter table "qa_TestCase" add column "typeCategory" text generated always as ("type" ->> 'category') stored; +alter table "qa_TestCase" add column "typeDetail" text generated always as ("type" ->> 'detail') stored; +alter table "qa_TestCaseResult" add column "statusCategory" text generated always as ("status" ->> 'category') stored; +alter table "qa_TestCaseResult" add column "statusDetail" text generated always as ("status" ->> 'detail') stored; +alter table "qa_TestCaseStepResult" add column "statusCategory" text generated always as ("status" ->> 'category') stored; +alter table "qa_TestCaseStepResult" add column "statusDetail" text generated always as ("status" ->> 'detail') stored; +alter table "qa_TestExecution" add column "statusCategory" text generated always as ("status" ->> 'category') stored; +alter table "qa_TestExecution" add column "statusDetail" text generated always as ("status" ->> 'detail') stored; alter table "qa_TestExecution" add column "testCaseResultsStatsFailure" integer generated always as (("testCaseResultsStats" -> 'failure')::integer) stored; alter table "qa_TestExecution" add column "testCaseResultsStatsSuccess" integer generated always as (("testCaseResultsStats" -> 'success')::integer) stored; alter table "qa_TestExecution" add column "testCaseResultsStatsSkipped" integer generated always as (("testCaseResultsStats" -> 'skipped')::integer) stored; alter table "qa_TestExecution" add column "testCaseResultsStatsUnknown" integer generated always as (("testCaseResultsStats" -> 'unknown')::integer) stored; alter table "qa_TestExecution" add column "testCaseResultsStatsCustom" integer generated always as (("testCaseResultsStats" -> 'custom')::integer) stored; alter table "qa_TestExecution" add column "testCaseResultsStatsTotal" integer generated always as (("testCaseResultsStats" -> 'total')::integer) stored; -alter table "qa_TestExecution" add column "deviceInfoName" text generated always as (("deviceInfo" -> 'name')::text) stored; -alter table "qa_TestExecution" add column "deviceInfoOs" text generated always as (("deviceInfo" -> 'os')::text) stored; -alter table "qa_TestExecution" add column "deviceInfoBrowser" text generated always as (("deviceInfo" -> 'browser')::text) stored; -alter table "qa_TestExecution" add column "deviceInfoType" text generated always as (("deviceInfo" -> 'type')::text) stored; -alter table "qa_TestSuite" add column "typeCategory" text generated always as(("type" ->> 'category'):: text) stored; -alter table "qa_TestSuite" add column "typeDetail" text generated always as(("type" ->> 'detail'):: text) stored; +alter table "qa_TestExecution" add column "deviceInfoName" text generated always as ("deviceInfo" -> 'name') stored; +alter table "qa_TestExecution" add column "deviceInfoOs" text generated always as ("deviceInfo" -> 'os') stored; +alter table "qa_TestExecution" add column "deviceInfoBrowser" text generated always as ("deviceInfo" -> 'browser') stored; +alter table "qa_TestExecution" add column "deviceInfoType" text generated always as ("deviceInfo" -> 'type') stored; +alter table "qa_TestSuite" add column "typeCategory" text generated always as ("type" ->> 'category') stored; +alter table "qa_TestSuite" add column "typeDetail" text generated always as ("type" ->> 'detail') stored; comment on column "qa_CodeQuality"."bugsValue" is 'generated'; comment on column "qa_CodeQuality"."branchCoverageValue" is 'generated'; From 805d5d0d49fed6ea64da6b0ca66213cf86e8763a Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Fri, 4 Nov 2022 09:56:08 -0700 Subject: [PATCH 5/8] Fix duplicate typeCategory field --- canonical-schema/V010__create_qa.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql index ce778547..9d5d4a32 100644 --- a/canonical-schema/V010__create_qa.sql +++ b/canonical-schema/V010__create_qa.sql @@ -195,8 +195,6 @@ alter table "qa_TestCase" add column "afterDescription" text generated always as alter table "qa_TestCase" add column "afterCondition" text generated always as ("after" ->> 'condition') stored; alter table "qa_TestCase" add column "typeCategory" text generated always as ("type" ->> 'category') stored; alter table "qa_TestCase" add column "typeDetail" text generated always as ("type" ->> 'detail') stored; -alter table "qa_TestCase" add column "typeCategory" text generated always as ("type" ->> 'category') stored; -alter table "qa_TestCase" add column "typeDetail" text generated always as ("type" ->> 'detail') stored; alter table "qa_TestCaseResult" add column "statusCategory" text generated always as ("status" ->> 'category') stored; alter table "qa_TestCaseResult" add column "statusDetail" text generated always as ("status" ->> 'detail') stored; alter table "qa_TestCaseStepResult" add column "statusCategory" text generated always as ("status" ->> 'category') stored; From 276afdb73b2e445b4ee2734676b6525d37ed859f Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Mon, 7 Nov 2022 11:44:01 -0800 Subject: [PATCH 6/8] Consistent usage of quotes in field names --- canonical-schema/V010__create_qa.sql | 184 +++++++++++++-------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql index 9d5d4a32..0e056981 100644 --- a/canonical-schema/V010__create_qa.sql +++ b/canonical-schema/V010__create_qa.sql @@ -4,43 +4,43 @@ create table "qa_CodeQuality" ( origin text, "refreshedAt" timestamptz not null default now(), uid text not null, - "bugs" jsonb, + bugs jsonb, "branchCoverage" jsonb, "codeSmells" jsonb, - "complexity" jsonb, - "coverage" jsonb, - "duplications" jsonb, + complexity jsonb, + coverage jsonb, + duplications jsonb, "duplicatedBlocks" jsonb, "lineCoverage" jsonb, "securityHotspots" jsonb, - "vulnerabilities" jsonb, + vulnerabilities jsonb, "createdAt" timestamptz, "pullRequest" text, - "repository" text + repository text ); create table "qa_TestCase" ( id text generated always as (pkey(source, uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), uid text not null, - "name" text, - "description" text, - "source" text, - "before" jsonb, - "after" jsonb, - "tags" jsonb, - "type" jsonb, - "task" text + name text, + description text, + source text, + before jsonb, + after jsonb, + tags jsonb, + type jsonb, + task text ); create table"qa_TestCaseResult" ( id text generated always as (pkey("testExecution", uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), uid text not null, - "description" text, + description text, "startedAt" timestamptz, "endedAt" timestamptz, - "status" jsonb, + status jsonb, "testCase" text, "testExecution" text ); @@ -49,10 +49,10 @@ create table "qa_TestCaseStep" ( origin text, "refreshedAt" timestamptz not null default now(), uid text not null, - "name" text, - "description" text, - "data" text, - "result" text, + name text, + description text, + data text, + result text, "testCase" text ); create table "qa_TestCaseStepResult" ( @@ -60,47 +60,47 @@ create table "qa_TestCaseStepResult" ( origin text, "refreshedAt" timestamptz not null default now(), uid text not null, - "status" jsonb, + status jsonb, "testStep" text, "testResult" text ); create table "qa_TestExecution" ( - id text generated always as (pkey("source", uid)) stored primary key, + id text generated always as (pkey(source, uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), uid text not null, - "name" text, - "description" text, - "source" text, + name text, + description text, + source text, "startedAt" timestamptz, "endedAt" timestamptz, - "status" jsonb, - "environments" jsonb, + status jsonb, + environments jsonb, "testCaseResultsStats" jsonb, "deviceInfo" jsonb, - "tags" jsonb, - "suite" text, - "task" text, - "build" text + tags jsonb, + suite text, + task text, + build text ); create table "qa_TestExecutionCommitAssociation" ( - id text generated always as (pkey("commit", "testExecution")) stored primary key, + id text generated always as (pkey(commit, "testExecution")) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), "testExecution" text, - "commit" text + commit text ); create table "qa_TestSuite" ( - id text generated always as (pkey("source", uid)) stored primary key, + id text generated always as (pkey(source, uid)) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), uid text not null, - "name" text, - "description" text, - "source" text, - "tags" jsonb, - "type" jsonb, - "task" text + name text, + description text, + source text, + tags jsonb, + type jsonb, + task text ); create table "qa_TestSuiteTestCaseAssociation" ( id text generated always as (pkey("testCase", "testSuite")) stored primary key, @@ -113,94 +113,94 @@ create table "tms_TaskTestCaseResultAssociation" ( id text generated always as (pkey("defect", "testCaseResult")) stored primary key, origin text, "refreshedAt" timestamptz not null default now(), - "defect" text, + defect text, "testCaseResult" text ); -- foreign keys -- alter table "qa_CodeQuality" add foreign key ("pullRequest") references "vcs_PullRequest"(id); -alter table "qa_CodeQuality" add foreign key ("repository") references "vcs_Repository"(id); -alter table "qa_TestCase" add foreign key ("task") references "tms_Task"(id); +alter table "qa_CodeQuality" add foreign key (repository) references "vcs_Repository"(id); +alter table "qa_TestCase" add foreign key (task) references "tms_Task"(id); alter table "qa_TestCaseResult" add foreign key ("testCase") references "qa_TestCase"(id); alter table "qa_TestCaseResult" add foreign key ("testExecution") references "qa_TestExecution"(id); alter table "qa_TestCaseStep" add foreign key ("testCase") references "qa_TestCase"(id); alter table "qa_TestCaseStepResult" add foreign key ("testStep") references "qa_TestCaseStep"(id); alter table "qa_TestCaseStepResult" add foreign key ("testResult") references "qa_TestCaseResult"(id); -alter table "qa_TestExecution" add foreign key ("suite") references "qa_TestSuite"(id); -alter table "qa_TestExecution" add foreign key ("task") references "tms_Task"(id); -alter table "qa_TestExecution" add foreign key ("build") references "cicd_Build"(id); +alter table "qa_TestExecution" add foreign key (suite) references "qa_TestSuite"(id); +alter table "qa_TestExecution" add foreign key (task) references "tms_Task"(id); +alter table "qa_TestExecution" add foreign key (build) references "cicd_Build"(id); alter table "qa_TestExecutionCommitAssociation" add foreign key ("testExecution") references "qa_TestExecution"(id); -alter table "qa_TestExecutionCommitAssociation" add foreign key ("commit") references "vcs_Commit"(id); -alter table "qa_TestSuite" add foreign key ("task") references "tms_Task"(id); +alter table "qa_TestExecutionCommitAssociation" add foreign key (commit) references "vcs_Commit"(id); +alter table "qa_TestSuite" add foreign key (task) references "tms_Task"(id); alter table "qa_TestSuiteTestCaseAssociation" add foreign key ("testSuite") references "qa_TestSuite"(id); alter table "qa_TestSuiteTestCaseAssociation" add foreign key ("testCase") references "qa_TestCase"(id); -alter table "tms_TaskTestCaseResultAssociation" add foreign key ("defect") references "tms_Task"(id); +alter table "tms_TaskTestCaseResultAssociation" add foreign key (defect) references "tms_Task"(id); alter table "tms_TaskTestCaseResultAssociation" add foreign key ("testCaseResult") references "qa_TestCaseResult"(id); -- indices -- -create index "qa_CodeQuality_origin_idx" on "qa_CodeQuality"("origin"); -create index "qa_CodeQuality_uid_idx" on "qa_CodeQuality"("uid"); +create index "qa_CodeQuality_origin_idx" on "qa_CodeQuality"(origin); +create index "qa_CodeQuality_uid_idx" on "qa_CodeQuality"(uid); create index "qa_CodeQuality_createdAt_idx" on "qa_CodeQuality"("createdAt"); create index "qa_CodeQuality_pull_request_idx" on "qa_CodeQuality"("pullRequest"); -create index "qa_CodeQuality_repository_idx" on "qa_CodeQuality"("repository"); -create index "qa_TestCase_origin_idx" on "qa_TestCase"("origin"); -create index "qa_TestCase_uid_idx" on "qa_TestCase"("uid"); -create index "qa_TestCase_task_idx" on "qa_TestCase"("task"); -create index "qa_TestCaseResult_origin_idx" on "qa_TestCaseResult"("origin"); -create index "qa_TestCaseResult_uid_idx" on "qa_TestCaseResult"("uid"); +create index "qa_CodeQuality_repository_idx" on "qa_CodeQuality"(repository); +create index "qa_TestCase_origin_idx" on "qa_TestCase"(origin); +create index "qa_TestCase_uid_idx" on "qa_TestCase"(uid); +create index "qa_TestCase_task_idx" on "qa_TestCase"(task); +create index "qa_TestCaseResult_origin_idx" on "qa_TestCaseResult"(origin); +create index "qa_TestCaseResult_uid_idx" on "qa_TestCaseResult"(uid); create index "qa_TestCaseResult_startedAt_idx" on "qa_TestCaseResult"("startedAt"); create index "qa_TestCaseResult_endedAt_idx" on "qa_TestCaseResult"("endedAt"); create index "qa_TestCaseResult_testCase_idx" on "qa_TestCaseResult"("testCase"); create index "qa_TestCaseResult_testExecution_idx" on "qa_TestCaseResult"("testExecution"); -create index "qa_TestCaseStep_origin_idx" on "qa_TestCaseStep"("origin"); -create index "qa_TestCaseStep_uid_idx" on "qa_TestCaseStep"("uid"); +create index "qa_TestCaseStep_origin_idx" on "qa_TestCaseStep"(origin); +create index "qa_TestCaseStep_uid_idx" on "qa_TestCaseStep"(uid); create index "qa_TestCaseStep_testCase_idx" on "qa_TestCaseStep"("testCase"); -create index "qa_TestCaseStepResult_origin_idx" on "qa_TestCaseStepResult"("origin"); -create index "qa_TestCaseStepResult_uid_idx" on "qa_TestCaseStepResult"("uid"); +create index "qa_TestCaseStepResult_origin_idx" on "qa_TestCaseStepResult"(origin); +create index "qa_TestCaseStepResult_uid_idx" on "qa_TestCaseStepResult"(uid); create index "qa_TestCaseStepResult_testStep_idx" on "qa_TestCaseStepResult"("testStep"); create index "qa_TestCaseStepResult_testResult_idx" on "qa_TestCaseStepResult"("testResult"); -create index "qa_TestExecution_origin_idx" on "qa_TestExecution"("origin"); -create index "qa_TestExecution_uid_idx" on "qa_TestExecution"("uid"); +create index "qa_TestExecution_origin_idx" on "qa_TestExecution"(origin); +create index "qa_TestExecution_uid_idx" on "qa_TestExecution"(uid); create index "qa_TestExecution_startedAt_idx" on "qa_TestExecution"("startedAt"); create index "qa_TestExecution_endedAt_idx" on "qa_TestExecution"("endedAt"); -create index "qa_TestExecution_suite_idx" on "qa_TestExecution"("suite"); -create index "qa_TestExecution_task_idx" on "qa_TestExecution"("task"); -create index "qa_TestExecution_build_idx" on "qa_TestExecution"("build"); -create index "qa_TestExecutionCommitAssociation_origin_idx" on "qa_TestExecutionCommitAssociation"("origin"); +create index "qa_TestExecution_suite_idx" on "qa_TestExecution"(suite); +create index "qa_TestExecution_task_idx" on "qa_TestExecution"(task); +create index "qa_TestExecution_build_idx" on "qa_TestExecution"(build); +create index "qa_TestExecutionCommitAssociation_origin_idx" on "qa_TestExecutionCommitAssociation"(origin); create index "qa_TestExecutionCommitAssociation_testExecution_idx" on "qa_TestExecutionCommitAssociation"("testExecution"); -create index "qa_TestExecutionCommitAssociation_commit_idx" on "qa_TestExecutionCommitAssociation"("commit"); -create index "qa_TestSuite_origin_idx" on "qa_TestSuite"("origin"); -create index "qa_TestSuite_uid_idx" on "qa_TestSuite"("uid"); -create index "qa_TestSuite_task_idx" on "qa_TestSuite"("task"); -create index "qa_TestSuiteTestCaseAssociation_origin_idx" on "qa_TestSuiteTestCaseAssociation"("origin"); +create index "qa_TestExecutionCommitAssociation_commit_idx" on "qa_TestExecutionCommitAssociation"(commit); +create index "qa_TestSuite_origin_idx" on "qa_TestSuite"(origin); +create index "qa_TestSuite_uid_idx" on "qa_TestSuite"(uid); +create index "qa_TestSuite_task_idx" on "qa_TestSuite"(task); +create index "qa_TestSuiteTestCaseAssociation_origin_idx" on "qa_TestSuiteTestCaseAssociation"(origin); create index "qa_TestSuiteTestCaseAssociation_testSuite_idx" on "qa_TestSuiteTestCaseAssociation"("testSuite"); create index "qa_TestSuiteTestCaseAssociation_testCase_idx" on "qa_TestSuiteTestCaseAssociation"("testCase"); -create index "tms_TaskTestCaseResultAssociation_defect_idx" on "tms_TaskTestCaseResultAssociation"("defect"); +create index "tms_TaskTestCaseResultAssociation_defect_idx" on "tms_TaskTestCaseResultAssociation"(defect); create index "tms_TaskTestCaseResultAssociation_testCaseResult_idx" on "tms_TaskTestCaseResultAssociation"("testCaseResult"); -- expansion -- -alter table "qa_CodeQuality" add column "bugsValue" text generated always as ("bugs" ->> 'value') stored; +alter table "qa_CodeQuality" add column "bugsValue" text generated always as (bugs ->> 'value') stored; alter table "qa_CodeQuality" add column "branchCoverageValue" text generated always as ("branchCoverage" ->> 'value') stored; alter table "qa_CodeQuality" add column "codeSmellsValue" text generated always as ("codeSmells" ->> 'value') stored; -alter table "qa_CodeQuality" add column "complexityValue" text generated always as ("complexity" ->> 'value') stored; -alter table "qa_CodeQuality" add column "coverageValue" text generated always as ("coverage" ->> 'value') stored; -alter table "qa_CodeQuality" add column "duplicationsValue" text generated always as ("duplications" ->> 'value') stored; +alter table "qa_CodeQuality" add column "complexityValue" text generated always as (complexity ->> 'value') stored; +alter table "qa_CodeQuality" add column "coverageValue" text generated always as (coverage ->> 'value') stored; +alter table "qa_CodeQuality" add column "duplicationsValue" text generated always as (duplications ->> 'value') stored; alter table "qa_CodeQuality" add column "duplicatedBlocksValue" text generated always as ("duplicatedBlocks" ->> 'value') stored; alter table "qa_CodeQuality" add column "lineCoverageValue" text generated always as ("lineCoverage" ->> 'value') stored; alter table "qa_CodeQuality" add column "securityHotspotsValue" text generated always as ("securityHotspots" ->> 'value') stored; -alter table "qa_CodeQuality" add column "vulnerabilitiesValue" text generated always as ("vulnerabilities" ->> 'value') stored; -alter table "qa_TestCase" add column "beforeDescription" text generated always as ("before" ->> 'description') stored; -alter table "qa_TestCase" add column "beforeCondition" text generated always as ("before" ->> 'condition') stored; -alter table "qa_TestCase" add column "afterDescription" text generated always as ("after" ->> 'description') stored; -alter table "qa_TestCase" add column "afterCondition" text generated always as ("after" ->> 'condition') stored; -alter table "qa_TestCase" add column "typeCategory" text generated always as ("type" ->> 'category') stored; -alter table "qa_TestCase" add column "typeDetail" text generated always as ("type" ->> 'detail') stored; -alter table "qa_TestCaseResult" add column "statusCategory" text generated always as ("status" ->> 'category') stored; -alter table "qa_TestCaseResult" add column "statusDetail" text generated always as ("status" ->> 'detail') stored; -alter table "qa_TestCaseStepResult" add column "statusCategory" text generated always as ("status" ->> 'category') stored; -alter table "qa_TestCaseStepResult" add column "statusDetail" text generated always as ("status" ->> 'detail') stored; -alter table "qa_TestExecution" add column "statusCategory" text generated always as ("status" ->> 'category') stored; -alter table "qa_TestExecution" add column "statusDetail" text generated always as ("status" ->> 'detail') stored; +alter table "qa_CodeQuality" add column "vulnerabilitiesValue" text generated always as (vulnerabilities ->> 'value') stored; +alter table "qa_TestCase" add column "beforeDescription" text generated always as (before ->> 'description') stored; +alter table "qa_TestCase" add column "beforeCondition" text generated always as (before ->> 'condition') stored; +alter table "qa_TestCase" add column "afterDescription" text generated always as (after ->> 'description') stored; +alter table "qa_TestCase" add column "afterCondition" text generated always as (after ->> 'condition') stored; +alter table "qa_TestCase" add column "typeCategory" text generated always as (type ->> 'category') stored; +alter table "qa_TestCase" add column "typeDetail" text generated always as (type ->> 'detail') stored; +alter table "qa_TestCaseResult" add column "statusCategory" text generated always as (status ->> 'category') stored; +alter table "qa_TestCaseResult" add column "statusDetail" text generated always as (status ->> 'detail') stored; +alter table "qa_TestCaseStepResult" add column "statusCategory" text generated always as (status ->> 'category') stored; +alter table "qa_TestCaseStepResult" add column "statusDetail" text generated always as (status ->> 'detail') stored; +alter table "qa_TestExecution" add column "statusCategory" text generated always as (status ->> 'category') stored; +alter table "qa_TestExecution" add column "statusDetail" text generated always as (status ->> 'detail') stored; alter table "qa_TestExecution" add column "testCaseResultsStatsFailure" integer generated always as (("testCaseResultsStats" -> 'failure')::integer) stored; alter table "qa_TestExecution" add column "testCaseResultsStatsSuccess" integer generated always as (("testCaseResultsStats" -> 'success')::integer) stored; alter table "qa_TestExecution" add column "testCaseResultsStatsSkipped" integer generated always as (("testCaseResultsStats" -> 'skipped')::integer) stored; @@ -211,8 +211,8 @@ alter table "qa_TestExecution" add column "deviceInfoName" text generated always alter table "qa_TestExecution" add column "deviceInfoOs" text generated always as ("deviceInfo" -> 'os') stored; alter table "qa_TestExecution" add column "deviceInfoBrowser" text generated always as ("deviceInfo" -> 'browser') stored; alter table "qa_TestExecution" add column "deviceInfoType" text generated always as ("deviceInfo" -> 'type') stored; -alter table "qa_TestSuite" add column "typeCategory" text generated always as ("type" ->> 'category') stored; -alter table "qa_TestSuite" add column "typeDetail" text generated always as ("type" ->> 'detail') stored; +alter table "qa_TestSuite" add column "typeCategory" text generated always as (type ->> 'category') stored; +alter table "qa_TestSuite" add column "typeDetail" text generated always as (type ->> 'detail') stored; comment on column "qa_CodeQuality"."bugsValue" is 'generated'; comment on column "qa_CodeQuality"."branchCoverageValue" is 'generated'; From 92fd78502b20a68ddfaac431dac2d6cb0911e641 Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Mon, 7 Nov 2022 11:48:39 -0800 Subject: [PATCH 7/8] Adds generated comments on id fields --- canonical-schema/V010__create_qa.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql index 0e056981..b686f930 100644 --- a/canonical-schema/V010__create_qa.sql +++ b/canonical-schema/V010__create_qa.sql @@ -137,6 +137,17 @@ alter table "qa_TestSuiteTestCaseAssociation" add foreign key ("testCase") refer alter table "tms_TaskTestCaseResultAssociation" add foreign key (defect) references "tms_Task"(id); alter table "tms_TaskTestCaseResultAssociation" add foreign key ("testCaseResult") references "qa_TestCaseResult"(id); +comment on column "qa_CodeQuality".id is 'generated'; +comment on column "qa_TestCase".id is 'generated'; +comment on column "qa_TestCaseResult".id is 'generated'; +comment on column "qa_TestCaseStep".id is 'generated'; +comment on column "qa_TestCaseStepResult".id is 'generated'; +comment on column "qa_TestExecution".id is 'generated'; +comment on column "qa_TestExecutionCommitAssociation".id is 'generated'; +comment on column "qa_TestSuite".id is 'generated'; +comment on column "qa_TestSuiteTestCaseAssociation".id is 'generated'; +comment on column "tms_TaskTestCaseResultAssociation".id is 'generated'; + -- indices -- create index "qa_CodeQuality_origin_idx" on "qa_CodeQuality"(origin); create index "qa_CodeQuality_uid_idx" on "qa_CodeQuality"(uid); From 39f31dc94b5b9ab88de472d12aa5de819997b23f Mon Sep 17 00:00:00 2001 From: Thomas Gerber Date: Mon, 7 Nov 2022 12:08:08 -0800 Subject: [PATCH 8/8] Adds missing indices --- canonical-schema/V010__create_qa.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/canonical-schema/V010__create_qa.sql b/canonical-schema/V010__create_qa.sql index b686f930..c42cd504 100644 --- a/canonical-schema/V010__create_qa.sql +++ b/canonical-schema/V010__create_qa.sql @@ -156,11 +156,17 @@ create index "qa_CodeQuality_pull_request_idx" on "qa_CodeQuality"("pullRequest" create index "qa_CodeQuality_repository_idx" on "qa_CodeQuality"(repository); create index "qa_TestCase_origin_idx" on "qa_TestCase"(origin); create index "qa_TestCase_uid_idx" on "qa_TestCase"(uid); +create index "qa_TestCase_source_idx" on "qa_TestCase"(source); +create index "qa_TestCase_before_idx" on "qa_TestCase" using gin(before); +create index "qa_TestCase_after_idx" on "qa_TestCase" using gin(after); +create index "qa_TestCase_tags_idx" on "qa_TestCase" using gin(tags); +create index "qa_TestCase_type_idx" on "qa_TestCase" using gin(type); create index "qa_TestCase_task_idx" on "qa_TestCase"(task); create index "qa_TestCaseResult_origin_idx" on "qa_TestCaseResult"(origin); create index "qa_TestCaseResult_uid_idx" on "qa_TestCaseResult"(uid); create index "qa_TestCaseResult_startedAt_idx" on "qa_TestCaseResult"("startedAt"); create index "qa_TestCaseResult_endedAt_idx" on "qa_TestCaseResult"("endedAt"); +create index "qa_TestCaseResult_status_idx" on "qa_TestCaseResult" using gin(status); create index "qa_TestCaseResult_testCase_idx" on "qa_TestCaseResult"("testCase"); create index "qa_TestCaseResult_testExecution_idx" on "qa_TestCaseResult"("testExecution"); create index "qa_TestCaseStep_origin_idx" on "qa_TestCaseStep"(origin); @@ -168,12 +174,17 @@ create index "qa_TestCaseStep_uid_idx" on "qa_TestCaseStep"(uid); create index "qa_TestCaseStep_testCase_idx" on "qa_TestCaseStep"("testCase"); create index "qa_TestCaseStepResult_origin_idx" on "qa_TestCaseStepResult"(origin); create index "qa_TestCaseStepResult_uid_idx" on "qa_TestCaseStepResult"(uid); +create index "qa_TestCaseStepResult_status_idx" on "qa_TestCaseStepResult" using gin(status); create index "qa_TestCaseStepResult_testStep_idx" on "qa_TestCaseStepResult"("testStep"); create index "qa_TestCaseStepResult_testResult_idx" on "qa_TestCaseStepResult"("testResult"); create index "qa_TestExecution_origin_idx" on "qa_TestExecution"(origin); create index "qa_TestExecution_uid_idx" on "qa_TestExecution"(uid); +create index "qa_TestExecution_source_idx" on "qa_TestExecution"(source); create index "qa_TestExecution_startedAt_idx" on "qa_TestExecution"("startedAt"); create index "qa_TestExecution_endedAt_idx" on "qa_TestExecution"("endedAt"); +create index "qa_TestExecution_status_idx" on "qa_TestExecution" using gin(status); +create index "qa_TestExecution_environments_idx" on "qa_TestExecution" using gin(environments); +create index "qa_TestExecution_tags_idx" on "qa_TestExecution" using gin(tags); create index "qa_TestExecution_suite_idx" on "qa_TestExecution"(suite); create index "qa_TestExecution_task_idx" on "qa_TestExecution"(task); create index "qa_TestExecution_build_idx" on "qa_TestExecution"(build); @@ -182,6 +193,9 @@ create index "qa_TestExecutionCommitAssociation_testExecution_idx" on "qa_TestEx create index "qa_TestExecutionCommitAssociation_commit_idx" on "qa_TestExecutionCommitAssociation"(commit); create index "qa_TestSuite_origin_idx" on "qa_TestSuite"(origin); create index "qa_TestSuite_uid_idx" on "qa_TestSuite"(uid); +create index "qa_TestSuite_source_idx" on "qa_TestSuite"(source); +create index "qa_TestSuite_tags_idx" on "qa_TestSuite" using gin(tags); +create index "qa_TestSuite_type_idx" on "qa_TestSuite" using gin(type); create index "qa_TestSuite_task_idx" on "qa_TestSuite"(task); create index "qa_TestSuiteTestCaseAssociation_origin_idx" on "qa_TestSuiteTestCaseAssociation"(origin); create index "qa_TestSuiteTestCaseAssociation_testSuite_idx" on "qa_TestSuiteTestCaseAssociation"("testSuite");