Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: remove unused typeorm parser and CODENOTIFY files (#18174)
h3n4l18c813c33331
diff --git a/backend/plugin/CODENOTIFY b/backend/plugin/CODENOTIFYdeleted file mode 100644index 401cf5af80..0000000000--- a/backend/plugin/CODENOTIFY+++ /dev/null@@ -1,4 +0,0 @@-# See https://github.com/sourcegraph/codenotify for documentation.--advisor* @rebelice-parser* @rebelice\ No newline at end of filediff --git a/backend/plugin/idp/CODENOTIFY b/backend/plugin/idp/CODENOTIFYdeleted file mode 100644index b58720ac88..0000000000--- a/backend/plugin/idp/CODENOTIFY+++ /dev/null@@ -1,3 +0,0 @@-# See https://github.com/sourcegraph/codenotify for documentation.--**/* @unknwondiff --git a/backend/plugin/parser/typeorm/parser.go b/backend/plugin/parser/typeorm/parser.godeleted file mode 100644index 9f64ea77e4..0000000000--- a/backend/plugin/parser/typeorm/parser.go+++ /dev/null@@ -1,41 +0,0 @@-// Package typeorm defines the sql extractor for typeorm migration scripts.-package typeorm--import (- "regexp"- "strings"-- "github.com/pkg/errors"-)--// Parse parses the typescript migration file.-func Parse(s string) ([]string, error) {- upIndex := strings.Index(s, "public async up(")- if upIndex < 0 {- return nil, errors.Errorf("unable to find up() function")- }- s = s[upIndex:]- downIndex := strings.Index(s, "public async down(")- if downIndex >= 0 {- s = s[:downIndex]- }- pattern := `await queryRunner\.query\(\s*(.+?)\s*[,]?\s*\);`-- // Compile the regular expression- re := regexp.MustCompile(pattern)-- // Find all matched statements- matches := re.FindAllStringSubmatch(s, -1)- var stmts []string- for _, m := range matches {- stmt := m[1]- if len(stmt) <= 2 {- return nil, errors.Errorf("invalid statement %s", stmt)- }- if stmt[0] != stmt[len(stmt)-1] {- return nil, errors.Errorf("invalid statement %s", stmt)- }- stmts = append(stmts, stmt[1:len(stmt)-1])- }- return stmts, nil-}diff --git a/backend/plugin/parser/typeorm/parser_test.go b/backend/plugin/parser/typeorm/parser_test.godeleted file mode 100644index e7e8cdccdf..0000000000--- a/backend/plugin/parser/typeorm/parser_test.go+++ /dev/null@@ -1,59 +0,0 @@-package typeorm--import (- "io"- "os"- "path"- "testing"-- "github.com/stretchr/testify/require"-)--func TestParse(t *testing.T) {- for _, tst := range []struct {- filename string- want []string- }{- {- "core_table.ts",- []string{- `CREATE TABLE "core"."refreshToken" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" uuid NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "deletedAt" TIMESTAMP WITH TIME ZONE, "revokedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_7d8bee0204106019488c4c50ffa" PRIMARY KEY ("id"))`,- `CREATE TABLE "core"."workspace" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "domainName" character varying, "displayName" character varying, "logo" character varying, "inviteHash" character varying, "deletedAt" TIMESTAMP, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_098656ae401f3e1a4586f47fd8e" PRIMARY KEY ("id"))`,- `CREATE TABLE "core"."user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "firstName" character varying NOT NULL DEFAULT '', "lastName" character varying NOT NULL DEFAULT '', "email" character varying NOT NULL, "emailVerified" boolean NOT NULL DEFAULT false, "disabled" boolean NOT NULL DEFAULT false, "passwordHash" character varying, "canImpersonate" boolean NOT NULL DEFAULT false, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP, "defaultWorkspaceId" uuid, CONSTRAINT "PK_a3ffb1c0c8416b9fc6f907b7433" PRIMARY KEY ("id"))`,- `ALTER TABLE "core"."refreshToken" ADD CONSTRAINT "FK_610102b60fea1455310ccd299de" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_5d77e050eabd28d203b301235a7" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,- },- },- {- "fix_expiration_time.ts",- []string{- "ALTER TABLE d_b_personal_access_token CHANGE expirationTime expirationTime timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)",- },- },- {- "update_user_table.ts",- []string{- `ALTER TABLE "users" ALTER COLUMN "password" SET DEFAULT ''`,- `ALTER TABLE "users" ALTER COLUMN "salt" SET DEFAULT ''`,- },- },- {- "user_project.ts",- []string{- "ALTER TABLE d_b_project MODIFY COLUMN `teamId` char(36) NULL",- "ALTER TABLE d_b_project ADD COLUMN `userId` char(36) NULL",- "CREATE INDEX `ind_userId` ON `d_b_project` (userId)",- },- },- } {- f, err := os.Open(path.Join("test-data", tst.filename))- require.NoError(t, err)- bytes, err := io.ReadAll(f)- require.NoError(t, err)- err = f.Close()- require.NoError(t, err)- got, err := Parse(string(bytes))- require.NoError(t, err)- require.Equal(t, tst.want, got)- }-}diff --git a/backend/plugin/parser/typeorm/test-data/core_table.ts b/backend/plugin/parser/typeorm/test-data/core_table.tsdeleted file mode 100644index 1a860cc3e5..0000000000--- a/backend/plugin/parser/typeorm/test-data/core_table.ts+++ /dev/null@@ -1,35 +0,0 @@-import { MigrationInterface, QueryRunner } from 'typeorm';--export class SetupCoreTables implements MigrationInterface {- name = 'SetupCoreTables1700324860820';-- public async up(queryRunner: QueryRunner): Promise<void> {- await queryRunner.query(- `CREATE TABLE "core"."refreshToken" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "userId" uuid NOT NULL, "expiresAt" TIMESTAMP WITH TIME ZONE NOT NULL, "deletedAt" TIMESTAMP WITH TIME ZONE, "revokedAt" TIMESTAMP WITH TIME ZONE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_7d8bee0204106019488c4c50ffa" PRIMARY KEY ("id"))`,- );- await queryRunner.query(- `CREATE TABLE "core"."workspace" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "domainName" character varying, "displayName" character varying, "logo" character varying, "inviteHash" character varying, "deletedAt" TIMESTAMP, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_098656ae401f3e1a4586f47fd8e" PRIMARY KEY ("id"))`,- );- await queryRunner.query(- `CREATE TABLE "core"."user" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "firstName" character varying NOT NULL DEFAULT '', "lastName" character varying NOT NULL DEFAULT '', "email" character varying NOT NULL, "emailVerified" boolean NOT NULL DEFAULT false, "disabled" boolean NOT NULL DEFAULT false, "passwordHash" character varying, "canImpersonate" boolean NOT NULL DEFAULT false, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP, "defaultWorkspaceId" uuid, CONSTRAINT "PK_a3ffb1c0c8416b9fc6f907b7433" PRIMARY KEY ("id"))`,- );- await queryRunner.query(- `ALTER TABLE "core"."refreshToken" ADD CONSTRAINT "FK_610102b60fea1455310ccd299de" FOREIGN KEY ("userId") REFERENCES "core"."user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,- );- await queryRunner.query(- `ALTER TABLE "core"."user" ADD CONSTRAINT "FK_5d77e050eabd28d203b301235a7" FOREIGN KEY ("defaultWorkspaceId") REFERENCES "core"."workspace"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,- );- }-- public async down(queryRunner: QueryRunner): Promise<void> {- await queryRunner.query(- `ALTER TABLE "core"."user" DROP CONSTRAINT "FK_5d77e050eabd28d203b301235a7"`,- );- await queryRunner.query(- `ALTER TABLE "core"."refreshToken" DROP CONSTRAINT "FK_610102b60fea1455310ccd299de"`,- );- await queryRunner.query(`DROP TABLE "core"."user"`);- await queryRunner.query(`DROP TABLE "core"."workspace"`);- await queryRunner.query(`DROP TABLE "core"."refreshToken"`);- }-}\ No newline at end of filediff --git a/backend/plugin/parser/typeorm/test-data/fix_expiration_time.ts b/backend/plugin/parser/typeorm/test-data/fix_expiration_time.tsdeleted file mode 100644index 62fa21d67b..0000000000--- a/backend/plugin/parser/typeorm/test-data/fix_expiration_time.ts+++ /dev/null@@ -1,14 +0,0 @@-/**- * Hello, World!- */-import { MigrationInterface, QueryRunner } from "typeorm";--export class PersonalAccessTokenFixExpirationTimeAutoUpdate1669892320740 implements MigrationInterface {- public async up(queryRunner: QueryRunner): Promise<void> {- await queryRunner.query(- `ALTER TABLE d_b_personal_access_token CHANGE expirationTime expirationTime timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)`,- );- }-- public async down(queryRunner: QueryRunner): Promise<void> {}-}diff --git a/backend/plugin/parser/typeorm/test-data/update_user_table.ts b/backend/plugin/parser/typeorm/test-data/update_user_table.tsdeleted file mode 100644index 044b79c808..0000000000--- a/backend/plugin/parser/typeorm/test-data/update_user_table.ts+++ /dev/null@@ -1,16 +0,0 @@-import { MigrationInterface, QueryRunner } from "typeorm";--export class UpdateUserTableForOIDC1668835311083 implements MigrationInterface {- name = 'UpdateUserTableForOIDC1668835311083'-- public async up(queryRunner: QueryRunner): Promise<void> {- await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "password" SET DEFAULT ''`);- await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "salt" SET DEFAULT ''`);- }-- public async down(queryRunner: QueryRunner): Promise<void> {- await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "salt" DROP DEFAULT`);- await queryRunner.query(`ALTER TABLE "users" ALTER COLUMN "password" DROP DEFAULT`);- }--}diff --git a/backend/plugin/parser/typeorm/test-data/user_project.ts b/backend/plugin/parser/typeorm/test-data/user_project.tsdeleted file mode 100644index 704f13fc01..0000000000--- a/backend/plugin/parser/typeorm/test-data/user_project.ts+++ /dev/null@@ -1,14 +0,0 @@-import { MigrationInterface, QueryRunner } from "typeorm";-import { columnExists } from "./helper/helper";--export class UserProjects1627287775965 implements MigrationInterface {- public async up(queryRunner: QueryRunner): Promise<any> {- if (!(await columnExists(queryRunner, "d_b_project", "userId"))) {- await queryRunner.query("ALTER TABLE d_b_project MODIFY COLUMN `teamId` char(36) NULL");- await queryRunner.query("ALTER TABLE d_b_project ADD COLUMN `userId` char(36) NULL");- await queryRunner.query("CREATE INDEX `ind_userId` ON `d_b_project` (userId)");- }- }-- public async down(queryRunner: QueryRunner): Promise<any> {}-}diff --git a/backend/store/CODENOTIFY b/backend/store/CODENOTIFYdeleted file mode 100644index be8aba0533..0000000000--- a/backend/store/CODENOTIFY+++ /dev/null@@ -1,3 +0,0 @@-# See https://github.com/sourcegraph/codenotify for documentation.--idp* @unknwon