Skip to content

Commit

Permalink
feat: update sql
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Jul 26, 2024
1 parent b2f9a4c commit 61b447a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 41 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"build": "pnpm -r do-build",
"rm": "find ./ -type d \\( -name \"dist\" -o -name \"node_modules\" \\) -exec rm -rf {} +",
"preinstall": "node ./scripts/check.js",
"prepare": "husky"
"prepare": "husky",
"migrate": "pnpm dlx prisma migrate dev --schema ./packages/canyon-backend/prisma/schema.prisma"
},
"devDependencies": {
"@commitlint/cli": "^19.2.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/canyon-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"mongoose": "^8.4.4",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"prisma": "^5.16.1",
"prisma": "5.16.1",
"reflect-metadata": "^0.1.14",
"rxjs": "^7.8.1",
"test-exclude": "^6.0.0",
Expand All @@ -58,7 +58,7 @@
"devDependencies": {
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@prisma/client": "^5.16.1",
"@prisma/client": "5.16.1",
"@types/express": "^4.17.21",
"@types/istanbul-lib-coverage": "^2.0.6",
"@types/istanbul-lib-source-maps": "^4.0.4",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ CREATE TABLE "project" (
"path_with_namespace" TEXT NOT NULL,
"description" TEXT NOT NULL,
"bu" TEXT NOT NULL,
"tag" TEXT NOT NULL,
"tags" JSONB NOT NULL,
"members" JSONB NOT NULL,
"coverage" TEXT NOT NULL,
"language" TEXT NOT NULL,
"default_branch" TEXT NOT NULL,
"instrument_cwd" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

CONSTRAINT "project_pkey" PRIMARY KEY ("id")
Expand All @@ -102,6 +104,16 @@ CREATE TABLE "codechange" (
CONSTRAINT "codechange_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "filepath" (
"id" TEXT NOT NULL,
"project_id" TEXT NOT NULL,
"sha" TEXT NOT NULL,
"path" TEXT NOT NULL,

CONSTRAINT "filepath_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "distributedlock" (
"lockName" TEXT NOT NULL,
Expand Down
11 changes: 2 additions & 9 deletions packages/canyon-backend/src/utils/coverage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as libCoverage from 'istanbul-lib-coverage';
import * as libSourceMaps from 'istanbul-lib-source-maps';
import {mergeCoverageMap as mergeCoverageMapOfCanyonData} from "@canyon/data";
import {merge_coverage_json_str} from "canyon-data";
// import {merge_coverage_json_str} from "canyon-data";
function parseInstrumentCwd(instrumentCwd) {
if (instrumentCwd.includes('=>')) {
const instrumentCwdSplit = instrumentCwd.split('=>');
Expand Down Expand Up @@ -85,12 +85,5 @@ function getJsonSize(jsonObj) {


export const mergeCoverageMap = (cov1: any, cov2: any) => {
// 超过2M的数据用js合并
const size = getJsonSize(cov1);
if (size > 0){
// console.log(`size of cov1: ${size}M`);
return mergeCoverageMapOfCanyonData(cov1, cov2)
} else {
return JSON.parse(merge_coverage_json_str(JSON.stringify(cov1), JSON.stringify(cov2)));
}
return mergeCoverageMapOfCanyonData(cov1, cov2)
}

0 comments on commit 61b447a

Please sign in to comment.