diff --git a/package.json b/package.json index 37c9e582..a9271ddf 100755 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/canyon-backend/package.json b/packages/canyon-backend/package.json index 95ff5dc6..0ce58a27 100755 --- a/packages/canyon-backend/package.json +++ b/packages/canyon-backend/package.json @@ -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", @@ -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", diff --git a/packages/canyon-backend/prisma/migrations/20240524055658_add_filepath/migration.sql b/packages/canyon-backend/prisma/migrations/20240524055658_add_filepath/migration.sql deleted file mode 100644 index 100dcfcd..00000000 --- a/packages/canyon-backend/prisma/migrations/20240524055658_add_filepath/migration.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Warnings: - - - Added the required column `language` to the `project` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "project" ADD COLUMN "language" TEXT NOT NULL; - --- 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") -); diff --git a/packages/canyon-backend/prisma/migrations/20240531030159_in/migration.sql b/packages/canyon-backend/prisma/migrations/20240531030159_in/migration.sql deleted file mode 100644 index f644d6bd..00000000 --- a/packages/canyon-backend/prisma/migrations/20240531030159_in/migration.sql +++ /dev/null @@ -1,10 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `tag` on the `project` table. All the data in the column will be lost. - - Added the required column `members` to the `project` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "project" DROP COLUMN "tag", -ADD COLUMN "members" JSONB NOT NULL; diff --git a/packages/canyon-backend/prisma/migrations/20240523025701_init/migration.sql b/packages/canyon-backend/prisma/migrations/20240726055230_init/migration.sql similarity index 90% rename from packages/canyon-backend/prisma/migrations/20240523025701_init/migration.sql rename to packages/canyon-backend/prisma/migrations/20240726055230_init/migration.sql index 17183cdb..ca8e9795 100644 --- a/packages/canyon-backend/prisma/migrations/20240523025701_init/migration.sql +++ b/packages/canyon-backend/prisma/migrations/20240726055230_init/migration.sql @@ -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") @@ -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, diff --git a/packages/canyon-backend/src/utils/coverage.ts b/packages/canyon-backend/src/utils/coverage.ts index acf1ccdf..38543d18 100755 --- a/packages/canyon-backend/src/utils/coverage.ts +++ b/packages/canyon-backend/src/utils/coverage.ts @@ -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('=>'); @@ -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) }