diff --git a/packages/canyon-backend/prisma/migrations/20240507032224_upd/migration.sql b/packages/canyon-backend/prisma/migrations/20240507032224_upd/migration.sql new file mode 100644 index 00000000..61a4e026 --- /dev/null +++ b/packages/canyon-backend/prisma/migrations/20240507032224_upd/migration.sql @@ -0,0 +1,10 @@ +/* + Warnings: + + - You are about to drop the column `cov_origin` on the `coverage` table. All the data in the column will be lost. + - Added the required column `rule` to the `coverage` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "coverage" DROP COLUMN "cov_origin", +ADD COLUMN "rule" TEXT NOT NULL; diff --git a/packages/canyon-backend/prisma/schema.prisma b/packages/canyon-backend/prisma/schema.prisma index 5bc94aa9..3a2e2087 100755 --- a/packages/canyon-backend/prisma/schema.prisma +++ b/packages/canyon-backend/prisma/schema.prisma @@ -55,7 +55,7 @@ model Coverage { reporter String reportID String @map("report_id") // 未来聚合的一句,区分case covType String @map("cov_type") // 普通类型,默认normal - covOrigin String @map("cov_origin") // 来源,比如ci + rule String // 规则 relationID Json @map("relation_id") // 关联ID,八位,{'0':'xxx','1':'xxx} summary Json tag Json // 存点额外的信息 diff --git a/packages/canyon-backend/src/coverage/services/consumer-coverage.service.ts b/packages/canyon-backend/src/coverage/services/consumer-coverage.service.ts index cdeeb000..6a393b70 100644 --- a/packages/canyon-backend/src/coverage/services/consumer-coverage.service.ts +++ b/packages/canyon-backend/src/coverage/services/consumer-coverage.service.ts @@ -128,7 +128,7 @@ export class ConsumerCoverageService { const newAgg = await this.prisma.coverage.create({ data: { covType: covType, - covOrigin: 'handmade', + rule: 'auto', relationID: '', summary: getSummaryByPath( '~', diff --git a/packages/canyon-backend/src/coverage/services/coverage-client.service.ts b/packages/canyon-backend/src/coverage/services/coverage-client.service.ts index 33d4e51f..f3e3dd6f 100755 --- a/packages/canyon-backend/src/coverage/services/coverage-client.service.ts +++ b/packages/canyon-backend/src/coverage/services/coverage-client.service.ts @@ -95,7 +95,7 @@ export class CoverageClientService { reporter: currentUser, reportID: coverageReport.reportID, covType: 'normal', - covOrigin: 'handmade', //没有就是手工 + rule: 'auto', //没有就是手工 summary: {}, tag: coverageReport.tags || {}, relationID: '', @@ -111,7 +111,7 @@ export class CoverageClientService { projectID: cov.projectID, reportID: cov.reportID, covType: 'normal', - covOrigin: cov.covOrigin, + rule: cov.rule, tag: JSON.stringify(cov.tag), createdAt: new Date(), });