Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Remove the obsolete StateType and StageRunnable
天舟c9872a9be7d2
diff --git a/backend/api/stage.go b/backend/api/stage.goindex d176b214a2..3907dad459 100644--- a/backend/api/stage.go+++ b/backend/api/stage.go@@ -5,29 +5,6 @@ import ("encoding/json")-type StageType string--const (- StageGeneral StageType = "bb.stage.general"- StageDatabaseCreate StageType = "bb.stage.database.create"- StageDatabaseGrant StageType = "bb.stage.database.grant"- StageDatabaseSchemaUpdate StageType = "bb.stage.database.schema.update"-)--func (e StageType) String() string {- switch e {- case StageGeneral:- return "bb.stage.general"- case StageDatabaseCreate:- return "bb.stage.database.create"- case StageDatabaseGrant:- return "bb.stage.database.grant"- case StageDatabaseSchemaUpdate:- return "bb.stage.database.schema.update"- }- return "bb.stage.unknown"-}-type Stage struct {ID int `jsonapi:"primary,stage"`@@ -47,8 +24,7 @@ type Stage struct {TaskList []*Task `jsonapi:"relation,task"`// Domain specific fields- Name string `jsonapi:"attr,name"`- Type StageType `jsonapi:"attr,type"`+ Name string `jsonapi:"attr,name"`}type StageCreate struct {@@ -62,8 +38,7 @@ type StageCreate struct {TaskList []TaskCreate `jsonapi:"attr,taskList"`// Domain specific fields- Name string `jsonapi:"attr,name"`- Type StageType `jsonapi:"attr,type"`+ Name string `jsonapi:"attr,name"`}type StageFind struct {diff --git a/backend/server/webhook.go b/backend/server/webhook.goindex 1def2b3d60..25cee0d82e 100644--- a/backend/server/webhook.go+++ b/backend/server/webhook.go@@ -130,7 +130,6 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {EnvironmentId: database.Instance.EnvironmentId,TaskList: []api.TaskCreate{*task},Name: fmt.Sprintf("Update %s schema", database.Name),- Type: api.StageDatabaseSchemaUpdate,}pipeline := &api.PipelineCreate{StageList: []api.StageCreate{*stage},diff --git a/backend/store/migration/0001_init_schema.up.sql b/backend/store/migration/0001_init_schema.up.sqlindex 91dc9c4b71..c9e15836d3 100644--- a/backend/store/migration/0001_init_schema.up.sql+++ b/backend/store/migration/0001_init_schema.up.sql@@ -413,8 +413,7 @@ CREATE TABLE stage (updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),pipeline_id INTEGER NOT NULL REFERENCES pipeline (id),environment_id INTEGER NOT NULL REFERENCES environment (id),- name TEXT NOT NULL,- `type` TEXT NOT NULL CHECK (`type` LIKE 'bb.stage.%')+ name TEXT NOT NULL);INSERT INTOdiff --git a/backend/store/seed/0100_stage.sql b/backend/store/seed/0100_stage.sqlindex 65ec7990c6..2a6be4544d 100644--- a/backend/store/seed/0100_stage.sql+++ b/backend/store/seed/0100_stage.sql@@ -6,8 +6,7 @@ INSERT INTOupdater_id,pipeline_id,environment_id,- name,- `type`+ name)VALUES(@@ -16,8 +15,7 @@ VALUES1001,9001,5004,- 'Prod',- 'bb.stage.schema.update'+ 'Prod');-- Stage for Pipeline 9002 add column@@ -28,8 +26,7 @@ INSERT INTOupdater_id,pipeline_id,environment_id,- name,- `type`+ name)VALUES(@@ -38,8 +35,7 @@ VALUES1003,9002,5001,- 'Sandbox A',- 'bb.stage.schema.update'+ 'Sandbox A');INSERT INTO@@ -49,8 +45,7 @@ INSERT INTOupdater_id,pipeline_id,environment_id,- name,- `type`+ name)VALUES(@@ -59,8 +54,7 @@ VALUES1003,9002,5002,- 'Integration',- 'bb.stage.schema.update'+ 'Integration');INSERT INTO@@ -70,8 +64,7 @@ INSERT INTOupdater_id,pipeline_id,environment_id,- name,- `type`+ name)VALUES(@@ -80,8 +73,7 @@ VALUES1003,9002,5003,- 'Staging',- 'bb.stage.schema.update'+ 'Staging');INSERT INTO@@ -91,8 +83,7 @@ INSERT INTOupdater_id,pipeline_id,environment_id,- name,- `type`+ name)VALUES(@@ -101,8 +92,7 @@ VALUES1003,9002,5004,- 'Prod',- 'bb.stage.schema.update'+ 'Prod');-- Stage for Pipeline 9003 create table@@ -113,8 +103,7 @@ INSERT INTOupdater_id,pipeline_id,environment_id,- name,- `type`+ name)VALUES(@@ -123,8 +112,7 @@ VALUES1003,9003,5001,- 'Sandbox A',- 'bb.stage.schema.update'+ 'Sandbox A');INSERT INTO@@ -134,8 +122,7 @@ INSERT INTOupdater_id,pipeline_id,environment_id,- name,- `type`+ name)VALUES(@@ -144,6 +131,5 @@ VALUES1003,9003,5002,- 'Integration',- 'bb.stage.schema.update'+ 'Integration');\ No newline at end of filediff --git a/backend/store/stage.go b/backend/store/stage.goindex 52751df3b8..0e9b0c8290 100644--- a/backend/store/stage.go+++ b/backend/store/stage.go@@ -90,18 +90,16 @@ func (s *StageService) createStage(ctx context.Context, tx *Tx, create *api.Stagupdater_id,pipeline_id,environment_id,- name,- `+"`type`"+`+ name)- VALUES (?, ?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, environment_id, name, `+"`type`"+`+ VALUES (?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, environment_id, name`+``,create.CreatorId,create.CreatorId,create.PipelineId,create.EnvironmentId,create.Name,- create.Type,)if err != nil {@@ -120,7 +118,6 @@ func (s *StageService) createStage(ctx context.Context, tx *Tx, create *api.Stag&stage.PipelineId,&stage.EnvironmentId,&stage.Name,- &stage.Type,); err != nil {return nil, FormatError(err)}@@ -147,8 +144,7 @@ func (s *StageService) findStageList(ctx context.Context, tx *Tx, find *api.Stagupdated_ts,pipeline_id,environment_id,- name,- `+"`type`"+`+ nameFROM stageWHERE `+strings.Join(where, " AND "),args...,@@ -171,7 +167,6 @@ func (s *StageService) findStageList(ctx context.Context, tx *Tx, find *api.Stag&stage.PipelineId,&stage.EnvironmentId,&stage.Name,- &stage.Type,); err != nil {return nil, FormatError(err)}diff --git a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.tsindex 6c8d3d3786..59eefd707b 100644--- a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts+++ b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts@@ -19,7 +19,6 @@ const template: IssueTemplate = {for (let i = 0; i < ctx.databaseList.length; i++) {stageList.push({name: `[${ctx.databaseList[i].instance.environment.name}] ${ctx.databaseList[i].name}`,- type: "bb.stage.schema.update",environmentId: ctx.environmentList[i].id,taskList: [{diff --git a/frontend/src/plugins/issue/DefaultTemplate.ts b/frontend/src/plugins/issue/DefaultTemplate.tsindex 156603e431..3e651714e1 100644--- a/frontend/src/plugins/issue/DefaultTemplate.ts+++ b/frontend/src/plugins/issue/DefaultTemplate.ts@@ -15,13 +15,15 @@ const template: IssueTemplate = {{name: "Troubleshoot database",environmentId: ctx.environmentList[0].id,- type: "bb.stage.general",taskList: [{name: "Troubleshoot database",status: "PENDING_APPROVAL",type: "bb.task.general",+ instanceId: UNKNOWN_ID,databaseId: UNKNOWN_ID,+ statement: "",+ rollbackStatement: "",},],},diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.tsindex 681992fa02..0238587a48 100644--- a/frontend/src/types/common.ts+++ b/frontend/src/types/common.ts@@ -251,7 +251,6 @@ export const unknown = (updater: UNKNOWN_PRINCIPAL,updatedTs: 0,name: "<<Unknown stage>>",- type: "bb.stage.general",environment: UNKNOWN_ENVIRONMENT,taskList: [],};@@ -530,7 +529,6 @@ export const empty = (updater: EMPTY_PRINCIPAL,updatedTs: 0,name: "",- type: "bb.stage.general",environment: EMPTY_ENVIRONMENT,taskList: [],};diff --git a/frontend/src/types/pipeline.ts b/frontend/src/types/pipeline.tsindex 1721df8c3c..bca220a960 100644--- a/frontend/src/types/pipeline.ts+++ b/frontend/src/types/pipeline.ts@@ -143,17 +143,6 @@ export type PipelineStatusPatch = {};// Stage-export type StageType =- | "bb.stage.general"- | "bb.stage.database.create"- | "bb.stage.database.grant"- | "bb.stage.schema.update";--export type StageRunnable = {- auto: boolean;- run: () => void;-};-// The database belongs to an instance which in turns belongs to an environment.// THus stage can access both instance and environment info.export type Stage = {@@ -172,8 +161,6 @@ export type Stage = {// Domain specific fieldsname: string;- type: StageType;- runnable?: StageRunnable;};export type StageCreate = {@@ -183,7 +170,6 @@ export type StageCreate = {// Domain specific fieldsname: string;- type: StageType;};// Task