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 workspace code from backend for now
天舟b116d1f9e838
diff --git a/backend/api/activity.go b/backend/api/activity.goindex 5d84913244..6aff318d9f 100644--- a/backend/api/activity.go+++ b/backend/api/activity.go@@ -51,14 +51,12 @@ type Activity struct {ID int `jsonapi:"primary,activity"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int-+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fields// The object where this activity belongs// e.g if Type is "bb.issue.xxx", then this field refers to the corresponding issue's id.@@ -73,8 +71,7 @@ type Activity struct {type ActivityCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Domain specific fieldsContainerId int `jsonapi:"attr,containerId"`@@ -86,9 +83,6 @@ type ActivityCreate struct {type ActivityFind struct {ID *int- // Standard fields- WorkspaceId *int-// Domain specific fieldsContainerId *int}@@ -106,8 +100,7 @@ type ActivityPatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsComment *string `jsonapi:"attr,comment"`diff --git a/backend/api/bookmark.go b/backend/api/bookmark.goindex 269dc59438..0e0972101c 100644--- a/backend/api/bookmark.go+++ b/backend/api/bookmark.go@@ -9,13 +9,12 @@ type Bookmark struct {ID int `jsonapi:"primary,bookmark"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Domain specific fieldsName string `jsonapi:"attr,name"`@@ -25,8 +24,7 @@ type Bookmark struct {type BookmarkCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Domain specific fieldsName string `jsonapi:"attr,name"`@@ -37,8 +35,7 @@ type BookmarkFind struct {ID *int// Standard fields- CreatorId *int- WorkspaceId *int+ CreatorId *int}func (find *BookmarkFind) String() string {diff --git a/backend/api/dataSource.go b/backend/api/dataSource.goindex 2a36d25519..b151a3088d 100644--- a/backend/api/dataSource.go+++ b/backend/api/dataSource.go@@ -29,13 +29,12 @@ type DataSource struct {ID int `jsonapi:"primary,dataSource"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fields// Just returns InstanceId and DatabaseId otherwise would cause circular dependency.@@ -52,8 +51,7 @@ type DataSource struct {type DataSourceCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsInstanceId int@@ -67,9 +65,6 @@ type DataSourceCreate struct {}type DataSourceFind struct {- // Standard fields- WorkspaceId *int-// Related fieldsInstanceId *intDatabaseId *int@@ -91,8 +86,7 @@ type DataSourcePatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsUsername *string `jsonapi:"attr,username"`diff --git a/backend/api/database.go b/backend/api/database.goindex f80a9faa98..2ebf09f970 100644--- a/backend/api/database.go+++ b/backend/api/database.go@@ -31,13 +31,12 @@ type Database struct {ID int `jsonapi:"primary,database"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fieldsProjectId int@@ -56,8 +55,7 @@ type Database struct {type DatabaseCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsProjectId int@@ -71,9 +69,6 @@ type DatabaseCreate struct {type DatabaseFind struct {ID *int- // Standard fields- WorkspaceId *int-// Related fieldsInstanceId *intProjectId *int@@ -96,8 +91,7 @@ type DatabasePatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Related fieldsProjectId *int `jsonapi:"attr,projectId"`diff --git a/backend/api/environment.go b/backend/api/environment.goindex 896c20c320..84b835b77a 100644--- a/backend/api/environment.go+++ b/backend/api/environment.go@@ -9,14 +9,13 @@ type Environment struct {ID int `jsonapi:"primary,environment"`// Standard fields- RowStatus RowStatus `jsonapi:"attr,rowStatus"`- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ RowStatus RowStatus `jsonapi:"attr,rowStatus"`+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Domain specific fieldsName string `jsonapi:"attr,name"`@@ -26,8 +25,7 @@ type Environment struct {type EnvironmentCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Domain specific fieldsName string `jsonapi:"attr,name"`@@ -37,8 +35,7 @@ type EnvironmentFind struct {ID *int// Standard fields- RowStatus *RowStatus- WorkspaceId *int+ RowStatus *RowStatus}func (find *EnvironmentFind) String() string {@@ -55,8 +52,7 @@ type EnvironmentPatch struct {// Standard fieldsRowStatus *string `jsonapi:"attr,rowStatus"`// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsName *string `jsonapi:"attr,name"`diff --git a/backend/api/instance.go b/backend/api/instance.goindex 904ffb8857..3eb608f0d6 100644--- a/backend/api/instance.go+++ b/backend/api/instance.go@@ -11,14 +11,13 @@ type Instance struct {ID int `jsonapi:"primary,instance"`// Standard fields- RowStatus RowStatus `jsonapi:"attr,rowStatus"`- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ RowStatus RowStatus `jsonapi:"attr,rowStatus"`+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fieldsEnvironmentId int@@ -39,8 +38,7 @@ type Instance struct {type InstanceCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsEnvironmentId int `jsonapi:"attr,environmentId"`@@ -59,8 +57,7 @@ type InstanceFind struct {ID *int// Standard fields- RowStatus *RowStatus- WorkspaceId *int+ RowStatus *RowStatus}func (find *InstanceFind) String() string {@@ -77,8 +74,7 @@ type InstancePatch struct {// Standard fieldsRowStatus *string `jsonapi:"attr,rowStatus"`// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsName *string `jsonapi:"attr,name"`diff --git a/backend/api/issue.go b/backend/api/issue.goindex 312753eaca..9b28854a40 100644--- a/backend/api/issue.go+++ b/backend/api/issue.go@@ -60,13 +60,12 @@ type Issue struct {ID int `jsonapi:"primary,issue"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fieldsProjectId int@@ -90,8 +89,7 @@ type Issue struct {type IssueCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsProjectId int `jsonapi:"attr,projectId"`@@ -112,9 +110,6 @@ type IssueCreate struct {type IssueFind struct {ID *int- // Standard fields- WorkspaceId *int-// Related fieldsProjectId *int@@ -138,8 +133,7 @@ type IssuePatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Related fieldsProjectId *int `jsonapi:"attr,projectId"`@@ -159,8 +153,7 @@ type IssueStatusPatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsStatus IssueStatus `jsonapi:"attr,status"`diff --git a/backend/api/member.go b/backend/api/member.goindex 34fda4af92..86f2df63a3 100644--- a/backend/api/member.go+++ b/backend/api/member.go@@ -29,13 +29,12 @@ type Member struct {ID int `jsonapi:"primary,member"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Domain specific fieldsRole Role `jsonapi:"attr,role"`@@ -46,8 +45,7 @@ type Member struct {type MemberCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Domain specific fieldsRole Role `jsonapi:"attr,role"`@@ -57,9 +55,6 @@ type MemberCreate struct {type MemberFind struct {ID *int- // Standard fields- WorkspaceId *int-// Domain specific fieldsPrincipalId *int}@@ -77,8 +72,7 @@ type MemberPatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsRole *string `jsonapi:"attr,role"`diff --git a/backend/api/pipeline.go b/backend/api/pipeline.goindex 1cafc18cfc..049f714047 100644--- a/backend/api/pipeline.go+++ b/backend/api/pipeline.go@@ -30,13 +30,12 @@ type Pipeline struct {ID int `jsonapi:"primary,pipeline"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fieldsStageList []*Stage `jsonapi:"relation,stage"`@@ -49,8 +48,7 @@ type Pipeline struct {type PipelineCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsStageList []StageCreate `jsonapi:"attr,stageList"`@@ -61,9 +59,6 @@ type PipelineCreate struct {type PipelineFind struct {ID *int-- // Standard fields- WorkspaceId *int}func (find *PipelineFind) String() string {@@ -79,8 +74,7 @@ type PipelinePatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsStatus *PipelineStatus `jsonapi:"attr,status"`diff --git a/backend/api/project.go b/backend/api/project.goindex 269db3fab3..85dc38757c 100644--- a/backend/api/project.go+++ b/backend/api/project.go@@ -11,14 +11,13 @@ type Project struct {ID int `jsonapi:"primary,project"`// Standard fields- RowStatus RowStatus `jsonapi:"attr,rowStatus"`- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ RowStatus RowStatus `jsonapi:"attr,rowStatus"`+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fieldsProjectMemberList []*ProjectMember `jsonapi:"relation,projectMember"`@@ -31,8 +30,7 @@ type Project struct {type ProjectCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Domain specific fieldsName string `jsonapi:"attr,name"`@@ -43,8 +41,7 @@ type ProjectFind struct {ID *int// Standard fields- RowStatus *RowStatus- WorkspaceId *int+ RowStatus *RowStatus// Domain specific fields// If present, will only find project containing PrincipalId as a member@@ -65,8 +62,7 @@ type ProjectPatch struct {// Standard fieldsRowStatus *string `jsonapi:"attr,rowStatus"`// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsName *string `jsonapi:"attr,name"`diff --git a/backend/api/project_member.go b/backend/api/project_member.goindex dee1ea874b..a656a9e7aa 100644--- a/backend/api/project_member.go+++ b/backend/api/project_member.go@@ -26,13 +26,12 @@ type ProjectMember struct {ID int `jsonapi:"primary,projectMember"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fields// Just returns ProjectId otherwise would cause circular dependency.@@ -47,8 +46,7 @@ type ProjectMember struct {type ProjectMemberCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsProjectId int@@ -61,9 +59,6 @@ type ProjectMemberCreate struct {type ProjectMemberFind struct {ID *int- // Standard fields- WorkspaceId *int-// Related fieldsProjectId *int}@@ -81,8 +76,7 @@ type ProjectMemberPatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsRole *string `jsonapi:"attr,role"`diff --git a/backend/api/stage.go b/backend/api/stage.goindex 07a018e725..d176b214a2 100644--- a/backend/api/stage.go+++ b/backend/api/stage.go@@ -32,13 +32,12 @@ type Stage struct {ID int `jsonapi:"primary,stage"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fields// Just returns PipelineId otherwise would cause circular dependency.@@ -55,8 +54,7 @@ type Stage struct {type StageCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsEnvironmentId int `jsonapi:"attr,environmentId"`@@ -71,9 +69,6 @@ type StageCreate struct {type StageFind struct {ID *int- // Standard fields- WorkspaceId *int-// Related fieldsPipelineId *int}diff --git a/backend/api/task.go b/backend/api/task.goindex e5e4bb9983..ad318f619d 100644--- a/backend/api/task.go+++ b/backend/api/task.go@@ -54,13 +54,12 @@ type Task struct {ID int `jsonapi:"primary,task"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fields// Just returns PipelineId and StageId otherwise would cause circular dependency.@@ -80,8 +79,7 @@ type Task struct {type TaskCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsPipelineId int@@ -98,9 +96,6 @@ type TaskCreate struct {type TaskFind struct {ID *int- // Standard fields- WorkspaceId *int-// Related fieldsPipelineId *intStageId *int@@ -122,8 +117,7 @@ type TaskStatusPatch struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- UpdaterId int- WorkspaceId int+ UpdaterId int// Domain specific fieldsStatus TaskStatus `jsonapi:"attr,status"`diff --git a/backend/api/task_run.go b/backend/api/task_run.goindex b2047ae95b..9fe9aba851 100644--- a/backend/api/task_run.go+++ b/backend/api/task_run.go@@ -37,13 +37,12 @@ type TaskRun struct {ID int `jsonapi:"primary,taskRun"`// Standard fields- CreatorId int- Creator *Principal `jsonapi:"attr,creator"`- CreatedTs int64 `jsonapi:"attr,createdTs"`- UpdaterId int- Updater *Principal `jsonapi:"attr,updater"`- UpdatedTs int64 `jsonapi:"attr,updatedTs"`- WorkspaceId int+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`// Related fieldsTaskId int `jsonapi:"attr,taskId"`@@ -58,8 +57,7 @@ type TaskRun struct {type TaskRunCreate struct {// Standard fields// Value is assigned from the jwt subject field passed by the client.- CreatorId int- WorkspaceId int+ CreatorId int// Related fieldsTaskId intdiff --git a/backend/api/workspace.go b/backend/api/workspace.godeleted file mode 100644index 29360b9bac..0000000000--- a/backend/api/workspace.go+++ /dev/null@@ -1,3 +0,0 @@-package api--const DEFAULT_WORKPSACE_ID = 1diff --git a/backend/server/acl.go b/backend/server/acl.goindex d63e111786..e5b4c50bdc 100644--- a/backend/server/acl.go+++ b/backend/server/acl.go@@ -25,9 +25,7 @@ func ACLMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.Hand// Gets principal id from the context.principalId := c.Get(GetPrincipalIdContextKey()).(int)- workspaceId := api.DEFAULT_WORKPSACE_IDmemberFind := &api.MemberFind{- WorkspaceId: &workspaceId,PrincipalId: &principalId,}member, err := s.MemberService.FindMember(context.Background(), memberFind)diff --git a/backend/server/activity.go b/backend/server/activity.goindex aad1c53a3b..6fc8aa3b89 100644--- a/backend/server/activity.go+++ b/backend/server/activity.go@@ -14,7 +14,7 @@ import (func (s *Server) registerActivityRoutes(g *echo.Group) {g.POST("/activity", func(c echo.Context) error {- activityCreate := &api.ActivityCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ activityCreate := &api.ActivityCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, activityCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create activity request").SetInternal(err)}@@ -38,10 +38,7 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {})g.GET("/activity", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_ID- activityFind := &api.ActivityFind{- WorkspaceId: &workspaceId,- }+ activityFind := &api.ActivityFind{}containerIdStr := c.QueryParams().Get("container")if containerIdStr != "" {containerId, err := strconv.Atoi(containerIdStr)@@ -75,9 +72,8 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {}activityPatch := &api.ActivityPatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, activityPatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch activity request").SetInternal(err)diff --git a/backend/server/auth.go b/backend/server/auth.goindex 2450838755..b7b95d36ce 100644--- a/backend/server/auth.go+++ b/backend/server/auth.go@@ -77,7 +77,6 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {}memberCreate := &api.MemberCreate{- WorkspaceId: api.DEFAULT_WORKPSACE_ID,CreatorId: api.SYSTEM_BOT_ID,Role: api.Developer,PrincipalId: user.ID,diff --git a/backend/server/bookmark.go b/backend/server/bookmark.goindex 4ba9bacf2d..9c76406634 100644--- a/backend/server/bookmark.go+++ b/backend/server/bookmark.go@@ -14,7 +14,7 @@ import (func (s *Server) registerBookmarkRoutes(g *echo.Group) {g.POST("/bookmark", func(c echo.Context) error {- bookmarkCreate := &api.BookmarkCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ bookmarkCreate := &api.BookmarkCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, bookmarkCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create bookmark request").SetInternal(err)}@@ -41,11 +41,9 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {})g.GET("/bookmark", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_IDcreatorId := c.Get(GetPrincipalIdContextKey()).(int)bookmarkFind := &api.BookmarkFind{- WorkspaceId: &workspaceId,- CreatorId: &creatorId,+ CreatorId: &creatorId,}list, err := s.BookmarkService.FindBookmarkList(context.Background(), bookmarkFind)if err != nil {diff --git a/backend/server/database.go b/backend/server/database.goindex 325ae996af..8a5dc98ecb 100644--- a/backend/server/database.go+++ b/backend/server/database.go@@ -14,7 +14,7 @@ import (func (s *Server) registerDatabaseRoutes(g *echo.Group) {g.POST("/database", func(c echo.Context) error {- databaseCreate := &api.DatabaseCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ databaseCreate := &api.DatabaseCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, databaseCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create database request").SetInternal(err)}@@ -41,10 +41,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {})g.GET("/database", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_ID- databaseFind := &api.DatabaseFind{- WorkspaceId: &workspaceId,- }+ databaseFind := &api.DatabaseFind{}if instanceIdStr := c.QueryParam("instance"); instanceIdStr != "" {instanceId, err := strconv.Atoi(instanceIdStr)if err != nil {@@ -106,9 +103,8 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {}databasePatch := &api.DatabasePatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, databasePatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch database request").SetInternal(err)diff --git a/backend/server/environment.go b/backend/server/environment.goindex efe10ecd37..1c1795f164 100644--- a/backend/server/environment.go+++ b/backend/server/environment.go@@ -15,7 +15,7 @@ import (func (s *Server) registerEnvironmentRoutes(g *echo.Group) {g.POST("/environment", func(c echo.Context) error {- environmentCreate := &api.EnvironmentCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ environmentCreate := &api.EnvironmentCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, environmentCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create environment request").SetInternal(err)}@@ -42,10 +42,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {})g.GET("/environment", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_ID- environmentFind := &api.EnvironmentFind{- WorkspaceId: &workspaceId,- }+ environmentFind := &api.EnvironmentFind{}if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {rowStatus := api.RowStatus(rowStatusStr)environmentFind.RowStatus = &rowStatus@@ -75,9 +72,8 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {}environmentPatch := &api.EnvironmentPatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, environmentPatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch environment request").SetInternal(err)@@ -110,7 +106,6 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {for _, item := range patchList {environmentPatch, _ := item.(*api.EnvironmentPatch)- environmentPatch.WorkspaceId = api.DEFAULT_WORKPSACE_IDenvironmentPatch.UpdaterId = c.Get(GetPrincipalIdContextKey()).(int)_, err = s.EnvironmentService.PatchEnvironment(context.Background(), environmentPatch)if err != nil {@@ -121,10 +116,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {}}- workspaceId := api.DEFAULT_WORKPSACE_ID- environmentFind := &api.EnvironmentFind{- WorkspaceId: &workspaceId,- }+ environmentFind := &api.EnvironmentFind{}list, err := s.EnvironmentService.FindEnvironmentList(context.Background(), environmentFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch environment list for reorder").SetInternal(err)diff --git a/backend/server/instance.go b/backend/server/instance.goindex 77bac16270..365f9d5db1 100644--- a/backend/server/instance.go+++ b/backend/server/instance.go@@ -14,7 +14,7 @@ import (func (s *Server) registerInstanceRoutes(g *echo.Group) {g.POST("/instance", func(c echo.Context) error {- instanceCreate := &api.InstanceCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ instanceCreate := &api.InstanceCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, instanceCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create instance request").SetInternal(err)}@@ -41,10 +41,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {})g.GET("/instance", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_ID- instanceFind := &api.InstanceFind{- WorkspaceId: &workspaceId,- }+ instanceFind := &api.InstanceFind{}if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {rowStatus := api.RowStatus(rowStatusStr)instanceFind.RowStatus = &rowStatus@@ -95,9 +92,8 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {}instancePatch := &api.InstancePatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, instancePatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch instance request").SetInternal(err)@@ -135,11 +131,10 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {}dataSourcePatch := &api.DataSourcePatch{- ID: adminDataSource.ID,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),- Username: instancePatch.Username,- Password: instancePatch.Password,+ ID: adminDataSource.ID,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ Username: instancePatch.Username,+ Password: instancePatch.Password,}_, err = s.DataSourceService.PatchDataSource(context.Background(), dataSourcePatch)if err != nil {diff --git a/backend/server/issue.go b/backend/server/issue.goindex 5bd839f3cf..4399175b4f 100644--- a/backend/server/issue.go+++ b/backend/server/issue.go@@ -15,13 +15,12 @@ import (func (s *Server) registerIssueRoutes(g *echo.Group) {g.POST("/issue", func(c echo.Context) error {- issueCreate := &api.IssueCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ issueCreate := &api.IssueCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, issueCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create issue request").SetInternal(err)}issueCreate.Pipeline.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)- issueCreate.Pipeline.WorkspaceId = api.DEFAULT_WORKPSACE_IDcreatedPipeline, err := s.PipelineService.CreatePipeline(context.Background(), &issueCreate.Pipeline)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create pipeline for issue").SetInternal(err)@@ -29,7 +28,6 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {for _, stageCreate := range issueCreate.Pipeline.StageList {stageCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)- stageCreate.WorkspaceId = api.DEFAULT_WORKPSACE_IDstageCreate.PipelineId = createdPipeline.IDcreatedStage, err := s.StageService.CreateStage(context.Background(), &stageCreate)if err != nil {@@ -38,7 +36,6 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {for _, taskCreate := range stageCreate.TaskList {taskCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)- taskCreate.WorkspaceId = api.DEFAULT_WORKPSACE_IDtaskCreate.PipelineId = createdPipeline.IDtaskCreate.StageId = createdStage.IDif taskCreate.Type == api.TaskDatabaseSchemaUpdate {@@ -79,7 +76,6 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {activityCreate := &api.ActivityCreate{CreatorId: c.Get(GetPrincipalIdContextKey()).(int),- WorkspaceId: api.DEFAULT_WORKPSACE_ID,ContainerId: issue.ID,Type: api.ActivityIssueCreate,}@@ -96,10 +92,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {})g.GET("/issue", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_ID- issueFind := &api.IssueFind{- WorkspaceId: &workspaceId,- }+ issueFind := &api.IssueFind{}projectIdStr := c.QueryParams().Get("project")if projectIdStr != "" {projectId, err := strconv.Atoi(projectIdStr)@@ -162,9 +155,8 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {}issuePatch := &api.IssuePatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, issuePatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch issue request").SetInternal(err)@@ -196,9 +188,8 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {}issueStatusPatch := &api.IssueStatusPatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, issueStatusPatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted update issue status request").SetInternal(err)@@ -214,9 +205,8 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {var pipelineStatus api.PipelineStatuspipelinePatch := &api.PipelinePatch{- ID: issue.PipelineId,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: issue.PipelineId,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}switch issueStatusPatch.Status {case api.Issue_Open:@@ -253,10 +243,9 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {}issuePatch := &api.IssuePatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),- Status: &issueStatusPatch.Status,+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ Status: &issueStatusPatch.Status,}updatedIssue, err := s.IssueService.PatchIssue(context.Background(), issuePatch)if err != nil {@@ -276,7 +265,6 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {activityCreate := &api.ActivityCreate{CreatorId: c.Get(GetPrincipalIdContextKey()).(int),- WorkspaceId: api.DEFAULT_WORKPSACE_ID,ContainerId: issue.ID,Type: api.ActivityIssueStatusUpdate,Comment: issueStatusPatch.Comment,diff --git a/backend/server/member.go b/backend/server/member.goindex 41589f042b..60d91b7b7e 100644--- a/backend/server/member.go+++ b/backend/server/member.go@@ -14,7 +14,7 @@ import (func (s *Server) registerMemberRoutes(g *echo.Group) {g.POST("/member", func(c echo.Context) error {- memberCreate := &api.MemberCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ memberCreate := &api.MemberCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, memberCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create member request").SetInternal(err)}@@ -41,10 +41,7 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {})g.GET("/member", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_ID- memberFind := &api.MemberFind{- WorkspaceId: &workspaceId,- }+ memberFind := &api.MemberFind{}list, err := s.MemberService.FindMemberList(context.Background(), memberFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch member list").SetInternal(err)@@ -70,9 +67,8 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {}memberPatch := &api.MemberPatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, memberPatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch member request").SetInternal(err)diff --git a/backend/server/project.go b/backend/server/project.goindex d43d38adca..fe406e07d9 100644--- a/backend/server/project.go+++ b/backend/server/project.go@@ -14,7 +14,7 @@ import (func (s *Server) registerProjectRoutes(g *echo.Group) {g.POST("/project", func(c echo.Context) error {- projectCreate := &api.ProjectCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ projectCreate := &api.ProjectCreate{}if err := jsonapi.UnmarshalPayload(c.Request().Body, projectCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create project request").SetInternal(err)}@@ -39,10 +39,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {})g.GET("/project", func(c echo.Context) error {- workspaceId := api.DEFAULT_WORKPSACE_ID- projectFind := &api.ProjectFind{- WorkspaceId: &workspaceId,- }+ projectFind := &api.ProjectFind{}if userIdStr := c.QueryParam("user"); userIdStr != "" {userId, err := strconv.Atoi(userIdStr)if err != nil {@@ -100,9 +97,8 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {}projectPatch := &api.ProjectPatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, projectPatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch project request").SetInternal(err)diff --git a/backend/server/project_member.go b/backend/server/project_member.goindex a8148a77bf..43202e6feb 100644--- a/backend/server/project_member.go+++ b/backend/server/project_member.go@@ -20,9 +20,8 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {}projectMemberCreate := &api.ProjectMemberCreate{- ProjectId: projectId,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),+ ProjectId: projectId,+ CreatorId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, projectMemberCreate); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create project membership request").SetInternal(err)@@ -59,9 +58,8 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {}projectMemberPatch := &api.ProjectMemberPatch{- ID: id,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),+ ID: id,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, projectMemberPatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted change project membership").SetInternal(err)diff --git a/backend/server/sql.go b/backend/server/sql.goindex 6437c196b0..d35f2b13a1 100644--- a/backend/server/sql.go+++ b/backend/server/sql.go@@ -72,10 +72,8 @@ func (s *Server) registerSqlRoutes(g *echo.Group) {resultSet.Error = err.Error()}- workspaceId := api.DEFAULT_WORKPSACE_IDdatabaseFind := &api.DatabaseFind{- WorkspaceId: &workspaceId,- InstanceId: &instance.ID,+ InstanceId: &instance.ID,}for _, schema := range schemaList {databaseFind.Name = &schema.Name@@ -84,11 +82,10 @@ func (s *Server) registerSqlRoutes(g *echo.Group) {if err != nil {if bytebase.ErrorCode(err) == bytebase.ENOTFOUND {databaseCreate := &api.DatabaseCreate{- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- ProjectId: api.DEFAULT_PROJECT_ID,- InstanceId: instance.ID,- Name: schema.Name,+ CreatorId: c.Get(GetPrincipalIdContextKey()).(int),+ ProjectId: api.DEFAULT_PROJECT_ID,+ InstanceId: instance.ID,+ Name: schema.Name,}_, err := s.DatabaseService.CreateDatabase(context.Background(), databaseCreate)if err != nil {@@ -105,7 +102,6 @@ func (s *Server) registerSqlRoutes(g *echo.Group) {ts := time.Now().Unix()databasePatch := &api.DatabasePatch{ID: database.ID,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),SyncStatus: &syncStatus,LastSuccessfulSyncTs: &ts,diff --git a/backend/server/task.go b/backend/server/task.goindex 32026fc590..2ac0b2a527 100644--- a/backend/server/task.go+++ b/backend/server/task.go@@ -33,9 +33,8 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {}taskStatusPatch := &api.TaskStatusPatch{- ID: taskId,- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),- WorkspaceId: api.DEFAULT_WORKPSACE_ID,+ ID: taskId,+ UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),}if err := jsonapi.UnmarshalPayload(c.Request().Body, taskStatusPatch); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted update task status request").SetInternal(err)@@ -129,10 +128,9 @@ func (s *Server) ComposeTaskRelationship(ctx context.Context, task *api.Task, infunc (s *Server) ChangeTaskStatus(ctx context.Context, task *api.Task, newStatus api.TaskStatus, updatorId int) (*api.Task, error) {taskStatusPatch := &api.TaskStatusPatch{- ID: task.ID,- UpdaterId: updatorId,- WorkspaceId: task.WorkspaceId,- Status: newStatus,+ ID: task.ID,+ UpdaterId: updatorId,+ Status: newStatus,}return s.ChangeTaskStatusWithPatch(ctx, task, taskStatusPatch)}@@ -189,7 +187,6 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,activityCreate := &api.ActivityCreate{CreatorId: taskStatusPatch.UpdaterId,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,ContainerId: issue.ID,Type: api.ActivityPipelineTaskStatusUpdate,Comment: taskStatusPatch.Comment,diff --git a/backend/server/task_scheduler.go b/backend/server/task_scheduler.goindex 98bd29f1dc..d2d4e6f63b 100644--- a/backend/server/task_scheduler.go+++ b/backend/server/task_scheduler.go@@ -43,11 +43,9 @@ func (s *TaskScheduler) Run() error {s.l.Error("Scheduler PANIC RECOVER", zap.Error(err))}}()- workspaceId := api.DEFAULT_WORKPSACE_IDstatus := api.TaskRunningtaskFind := &api.TaskFind{- WorkspaceId: &workspaceId,- Status: &status,+ Status: &status,}list, err := s.server.TaskService.FindTaskList(context.Background(), taskFind)if err != nil {diff --git a/backend/store/activity.go b/backend/store/activity.goindex abab6cb044..6cd463b34f 100644--- a/backend/store/activity.go+++ b/backend/store/activity.go@@ -131,18 +131,16 @@ func createActivity(ctx context.Context, tx *Tx, create *api.ActivityCreate) (*aINSERT INTO activity (creator_id,updater_id,- workspace_id,container_id,`+"`type`,"+`comment,payload)- VALUES (?, ?, ?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, container_id, `+"`type`, comment, payload"+`+ VALUES (?, ?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, container_id, `+"`type`, comment, payload"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.ContainerId,create.Type,create.Comment,@@ -162,7 +160,6 @@ func createActivity(ctx context.Context, tx *Tx, create *api.ActivityCreate) (*a&activity.CreatedTs,&activity.UpdaterId,&activity.UpdatedTs,- &activity.WorkspaceId,&activity.ContainerId,&activity.Type,&activity.Comment,@@ -180,9 +177,6 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []if v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.ContainerId; v != nil {where, args = append(where, "container_id = ?"), append(args, *v)}@@ -194,7 +188,6 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []created_ts,updater_id,updated_ts,- workspace_id,container_id,`+"`type`,"+`comment,@@ -218,7 +211,6 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []&activity.CreatedTs,&activity.UpdaterId,&activity.UpdatedTs,- &activity.WorkspaceId,&activity.ContainerId,&activity.Type,&activity.Comment,@@ -251,7 +243,7 @@ func patchActivity(ctx context.Context, tx *Tx, patch *api.ActivityPatch) (*api.UPDATE activitySET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, container_id, `+"`type`, comment, payload"+`+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, container_id, `+"`type`, comment, payload"+``,args...,)@@ -268,7 +260,6 @@ func patchActivity(ctx context.Context, tx *Tx, patch *api.ActivityPatch) (*api.&activity.CreatedTs,&activity.UpdaterId,&activity.UpdatedTs,- &activity.WorkspaceId,&activity.ContainerId,&activity.Type,&activity.Comment,diff --git a/backend/store/bookmark.go b/backend/store/bookmark.goindex c7da95920e..969b889526 100644--- a/backend/store/bookmark.go+++ b/backend/store/bookmark.go@@ -110,16 +110,14 @@ func createBookmark(ctx context.Context, tx *Tx, create *api.BookmarkCreate) (*aINSERT INTO bookmark (creator_id,updater_id,- workspace_id,name,link)- VALUES (?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, link+ VALUES (?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, name, link`,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.Name,create.Link,)@@ -137,7 +135,6 @@ func createBookmark(ctx context.Context, tx *Tx, create *api.BookmarkCreate) (*a&bookmark.CreatedTs,&bookmark.UpdaterId,&bookmark.UpdatedTs,- &bookmark.WorkspaceId,&bookmark.Name,&bookmark.Link,); err != nil {@@ -156,9 +153,6 @@ func findBookmarkList(ctx context.Context, tx *Tx, find *api.BookmarkFind) (_ []if v := find.CreatorId; v != nil {where, args = append(where, "creator_id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }rows, err := tx.QueryContext(ctx, `SELECT@@ -167,7 +161,6 @@ func findBookmarkList(ctx context.Context, tx *Tx, find *api.BookmarkFind) (_ []created_ts,updater_id,updated_ts,- workspace_id,name,linkFROM bookmark@@ -189,7 +182,6 @@ func findBookmarkList(ctx context.Context, tx *Tx, find *api.BookmarkFind) (_ []&bookmark.CreatedTs,&bookmark.UpdaterId,&bookmark.UpdatedTs,- &bookmark.WorkspaceId,&bookmark.Name,&bookmark.Link,); err != nil {diff --git a/backend/store/dataSource.go b/backend/store/dataSource.goindex fcdc6cc67b..c9e1231462 100644--- a/backend/store/dataSource.go+++ b/backend/store/dataSource.go@@ -110,7 +110,6 @@ func (s *DataSourceService) createDataSource(ctx context.Context, tx *Tx, createINSERT INTO data_source (creator_id,updater_id,- workspace_id,instance_id,database_id,name,@@ -118,12 +117,11 @@ func (s *DataSourceService) createDataSource(ctx context.Context, tx *Tx, createusername,password)- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, instance_id, database_id, name, type, username, password+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, instance_id, database_id, name, type, username, password`,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.InstanceId,create.DatabaseId,create.Name,@@ -145,7 +143,6 @@ func (s *DataSourceService) createDataSource(ctx context.Context, tx *Tx, create&dataSource.CreatedTs,&dataSource.UpdaterId,&dataSource.UpdatedTs,- &dataSource.WorkspaceId,&dataSource.InstanceId,&dataSource.DatabaseId,&dataSource.Name,@@ -162,9 +159,6 @@ func (s *DataSourceService) createDataSource(ctx context.Context, tx *Tx, createfunc (s *DataSourceService) findDataSourceList(ctx context.Context, tx *Tx, find *api.DataSourceFind) (_ []*api.DataSource, err error) {// Build WHERE clause.where, args := []string{"1 = 1"}, []interface{}{}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.InstanceId; v != nil {where, args = append(where, "instance_id = ?"), append(args, *v)}@@ -182,7 +176,6 @@ func (s *DataSourceService) findDataSourceList(ctx context.Context, tx *Tx, findcreated_ts,updater_id,updated_ts,- workspace_id,instance_id,database_id,name,@@ -208,7 +201,6 @@ func (s *DataSourceService) findDataSourceList(ctx context.Context, tx *Tx, find&dataSource.CreatedTs,&dataSource.UpdaterId,&dataSource.UpdatedTs,- &dataSource.WorkspaceId,&dataSource.InstanceId,&dataSource.DatabaseId,&dataSource.Name,@@ -246,7 +238,7 @@ func (s *DataSourceService) patchDataSource(ctx context.Context, tx *Tx, patch *UPDATE data_sourceSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, instance_id, database_id, name, type, username, password+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, instance_id, database_id, name, type, username, password`,args...,)@@ -263,7 +255,6 @@ func (s *DataSourceService) patchDataSource(ctx context.Context, tx *Tx, patch *&dataSource.CreatedTs,&dataSource.UpdaterId,&dataSource.UpdatedTs,- &dataSource.WorkspaceId,&dataSource.InstanceId,&dataSource.DatabaseId,&dataSource.Name,diff --git a/backend/store/database.go b/backend/store/database.goindex 41c8310aa2..20c72ff851 100644--- a/backend/store/database.go+++ b/backend/store/database.go@@ -110,7 +110,6 @@ func (s *DatabaseService) createDatabase(ctx context.Context, tx *Tx, create *apINSERT INTO db (creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -118,12 +117,11 @@ func (s *DatabaseService) createDatabase(ctx context.Context, tx *Tx, create *aplast_successful_sync_ts,fingerprint)- VALUES (?, ?, ?, ?, ?, ?, 'OK', (strftime('%s', 'now')), '')- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, instance_id, project_id, name, sync_status, last_successful_sync_ts, fingerprint+ VALUES (?, ?, ?, ?, ?, 'OK', (strftime('%s', 'now')), '')+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, instance_id, project_id, name, sync_status, last_successful_sync_ts, fingerprint`,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.InstanceId,create.ProjectId,create.Name,@@ -142,7 +140,6 @@ func (s *DatabaseService) createDatabase(ctx context.Context, tx *Tx, create *ap&database.CreatedTs,&database.UpdaterId,&database.UpdatedTs,- &database.WorkspaceId,&database.InstanceId,&database.ProjectId,&database.Name,@@ -162,9 +159,6 @@ func (s *DatabaseService) findDatabaseList(ctx context.Context, tx *Tx, find *apif v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.InstanceId; v != nil {where, args = append(where, "instance_id = ?"), append(args, *v)}@@ -185,7 +179,6 @@ func (s *DatabaseService) findDatabaseList(ctx context.Context, tx *Tx, find *apcreated_ts,updater_id,updated_ts,- workspace_id,instance_id,project_id,name,@@ -211,7 +204,6 @@ func (s *DatabaseService) findDatabaseList(ctx context.Context, tx *Tx, find *ap&database.CreatedTs,&database.UpdaterId,&database.UpdatedTs,- &database.WorkspaceId,&database.InstanceId,&database.ProjectId,&database.Name,@@ -252,7 +244,7 @@ func (s *DatabaseService) patchDatabase(ctx context.Context, tx *Tx, patch *api.UPDATE dbSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, instance_id, project_id, name, sync_status, last_successful_sync_ts, fingerprint+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, instance_id, project_id, name, sync_status, last_successful_sync_ts, fingerprint`,args...,)@@ -269,7 +261,6 @@ func (s *DatabaseService) patchDatabase(ctx context.Context, tx *Tx, patch *api.&database.CreatedTs,&database.UpdaterId,&database.UpdatedTs,- &database.WorkspaceId,&database.InstanceId,&database.ProjectId,&database.Name,diff --git a/backend/store/environment.go b/backend/store/environment.goindex 4a5b68b4f0..2c338dd418 100644--- a/backend/store/environment.go+++ b/backend/store/environment.go@@ -109,11 +109,9 @@ func (s *EnvironmentService) createEnvironment(ctx context.Context, tx *Tx, crearow1, err1 := tx.QueryContext(ctx, `SELECT `+"`order`"+`FROM environment- WHERE workspace_id = ?ORDER BY `+"`order`"+` DESCLIMIT 1- `,- create.WorkspaceId)+ `)if err1 != nil {return nil, FormatError(err1)@@ -133,16 +131,14 @@ func (s *EnvironmentService) createEnvironment(ctx context.Context, tx *Tx, creaINSERT INTO environment (creator_id,updater_id,- workspace_id,name,`+"`order`"+`)- VALUES (?, ?, ?, ?, ?)- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, `+"`order`"+`+ VALUES (?, ?, ?, ?)+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`order`"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.Name,order+1,)@@ -161,7 +157,6 @@ func (s *EnvironmentService) createEnvironment(ctx context.Context, tx *Tx, crea&environment.CreatedTs,&environment.UpdaterId,&environment.UpdatedTs,- &environment.WorkspaceId,&environment.Name,&environment.Order,); err != nil {@@ -180,9 +175,6 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, fiif v := find.RowStatus; v != nil {where, args = append(where, "row_status = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }rows, err := tx.QueryContext(ctx, `SELECT@@ -192,7 +184,6 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, ficreated_ts,updater_id,updated_ts,- workspace_id,name,`+"`order`"+`FROM environment@@ -215,7 +206,6 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, fi&environment.CreatedTs,&environment.UpdaterId,&environment.UpdatedTs,- &environment.WorkspaceId,&environment.Name,&environment.Order,); err != nil {@@ -252,7 +242,7 @@ func (s *EnvironmentService) patchEnvironment(ctx context.Context, tx *Tx, patchUPDATE environmentSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, `+"`order`"+`+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`order`"+``,args...,)@@ -270,7 +260,6 @@ func (s *EnvironmentService) patchEnvironment(ctx context.Context, tx *Tx, patch&environment.CreatedTs,&environment.UpdaterId,&environment.UpdatedTs,- &environment.WorkspaceId,&environment.Name,&environment.Order,); err != nil {diff --git a/backend/store/instance.go b/backend/store/instance.goindex 34fb739613..abbd1c5ea1 100644--- a/backend/store/instance.go+++ b/backend/store/instance.go@@ -110,7 +110,6 @@ func createInstance(ctx context.Context, tx *Tx, create *api.InstanceCreate) (*aINSERT INTO instance (creator_id,updater_id,- workspace_id,environment_id,name,engine,@@ -119,11 +118,10 @@ func createInstance(ctx context.Context, tx *Tx, create *api.InstanceCreate) (*aport)VALUES (?, ?, ?, ?, ?, ?, ?, ?)- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, workspace_id, environment_id, name, engine, external_link, host, port+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, environment_id, name, engine, external_link, host, port`,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.EnvironmentId,create.Name,create.ExternalLink,@@ -145,7 +143,6 @@ func createInstance(ctx context.Context, tx *Tx, create *api.InstanceCreate) (*a&instance.CreatedTs,&instance.UpdaterId,&instance.UpdatedTs,- &instance.WorkspaceId,&instance.EnvironmentId,&instance.Name,&instance.Engine,@@ -168,9 +165,6 @@ func findInstanceList(ctx context.Context, tx *Tx, find *api.InstanceFind) (_ []if v := find.RowStatus; v != nil {where, args = append(where, "row_status = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }rows, err := tx.QueryContext(ctx, `SELECT@@ -180,7 +174,6 @@ func findInstanceList(ctx context.Context, tx *Tx, find *api.InstanceFind) (_ []created_ts,updater_id,updated_ts,- workspace_id,environment_id,name,engine,@@ -207,7 +200,6 @@ func findInstanceList(ctx context.Context, tx *Tx, find *api.InstanceFind) (_ []&instance.CreatedTs,&instance.UpdaterId,&instance.UpdatedTs,- &instance.WorkspaceId,&instance.EnvironmentId,&instance.Name,&instance.Engine,@@ -254,7 +246,7 @@ func patchInstance(ctx context.Context, tx *Tx, patch *api.InstancePatch) (*api.UPDATE instanceSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, workspace_id, environment_id, name, engine, external_link, host, port+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, environment_id, name, engine, external_link, host, port`,args...,)@@ -272,7 +264,6 @@ func patchInstance(ctx context.Context, tx *Tx, patch *api.InstancePatch) (*api.&instance.CreatedTs,&instance.UpdaterId,&instance.UpdatedTs,- &instance.WorkspaceId,&instance.EnvironmentId,&instance.Name,&instance.Engine,diff --git a/backend/store/issue.go b/backend/store/issue.goindex 88a24a3208..e5940dfa14 100644--- a/backend/store/issue.go+++ b/backend/store/issue.go@@ -119,7 +119,6 @@ func (s *IssueService) createIssue(ctx context.Context, tx *Tx, create *api.IssuINSERT INTO issue (creator_id,updater_id,- workspace_id,project_id,pipeline_id,name,@@ -132,12 +131,11 @@ func (s *IssueService) createIssue(ctx context.Context, tx *Tx, create *api.Issurollback_sql,payload)- VALUES (?, ?, ?, ?, ?, ?, 'OPEN', ?, ?, ?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, project_id, pipeline_id, name, `+"`status`, `type`, description, assignee_id, subscriber_id_list, `sql`, rollback_sql, payload"+`+ VALUES (?, ?, ?, ?, ?, 'OPEN', ?, ?, ?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, pipeline_id, name, `+"`status`, `type`, description, assignee_id, subscriber_id_list, `sql`, rollback_sql, payload"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.ProjectId,create.PipelineId,create.Name,@@ -165,7 +163,6 @@ func (s *IssueService) createIssue(ctx context.Context, tx *Tx, create *api.Issu&issue.CreatedTs,&issue.UpdaterId,&issue.UpdatedTs,- &issue.WorkspaceId,&issue.ProjectId,&issue.PipelineId,&issue.Name,@@ -209,9 +206,6 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issuif v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.PipelineId; v != nil {where, args = append(where, "pipeline_id = ?"), append(args, *v)}@@ -231,7 +225,6 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issucreated_ts,updater_id,updated_ts,- workspace_id,project_id,pipeline_id,name,@@ -264,7 +257,6 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issu&issue.CreatedTs,&issue.UpdaterId,&issue.UpdatedTs,- &issue.WorkspaceId,&issue.ProjectId,&issue.PipelineId,&issue.Name,@@ -339,7 +331,7 @@ func (s *IssueService) patchIssue(ctx context.Context, tx *Tx, patch *api.IssuePUPDATE issueSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, project_id, pipeline_id, name, `+"`status`, `type`, description, assignee_id, subscriber_id_list, `sql`, rollback_sql, payload"+`+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, pipeline_id, name, `+"`status`, `type`, description, assignee_id, subscriber_id_list, `sql`, rollback_sql, payload"+``,args...,)@@ -358,7 +350,6 @@ func (s *IssueService) patchIssue(ctx context.Context, tx *Tx, patch *api.IssueP&issue.CreatedTs,&issue.UpdaterId,&issue.UpdatedTs,- &issue.WorkspaceId,&issue.ProjectId,&issue.PipelineId,&issue.Name,diff --git a/backend/store/member.go b/backend/store/member.goindex 23da5f0bd5..1f8d6c9475 100644--- a/backend/store/member.go+++ b/backend/store/member.go@@ -131,16 +131,14 @@ func createMember(ctx context.Context, tx *Tx, create *api.MemberCreate) (*api.MINSERT INTO member (creator_id,updater_id,- workspace_id,role,principal_id)- VALUES (?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, role, principal_id+ VALUES (?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, role, principal_id`,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.Role,create.PrincipalId,)@@ -158,7 +156,6 @@ func createMember(ctx context.Context, tx *Tx, create *api.MemberCreate) (*api.M&member.CreatedTs,&member.UpdaterId,&member.UpdatedTs,- &member.WorkspaceId,&member.Role,&member.PrincipalId,); err != nil {@@ -174,9 +171,6 @@ func findMemberList(ctx context.Context, tx *Tx, find *api.MemberFind) (_ []*apiif v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.PrincipalId; v != nil {where, args = append(where, "principal_id = ?"), append(args, *v)}@@ -188,7 +182,6 @@ func findMemberList(ctx context.Context, tx *Tx, find *api.MemberFind) (_ []*apicreated_ts,updater_id,updated_ts,- workspace_id,role,principal_idFROM member@@ -210,7 +203,6 @@ func findMemberList(ctx context.Context, tx *Tx, find *api.MemberFind) (_ []*api&member.CreatedTs,&member.UpdaterId,&member.UpdatedTs,- &member.WorkspaceId,&member.Role,&member.PrincipalId,); err != nil {@@ -241,7 +233,7 @@ func patchMember(ctx context.Context, tx *Tx, patch *api.MemberPatch) (*api.MembUPDATE memberSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, role, principal_id+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, role, principal_id`,args...,)@@ -258,7 +250,6 @@ func patchMember(ctx context.Context, tx *Tx, patch *api.MemberPatch) (*api.Memb&member.CreatedTs,&member.UpdaterId,&member.UpdatedTs,- &member.WorkspaceId,&member.Role,&member.PrincipalId,); err != nil {diff --git a/backend/store/migration/0001_init_schema.down.sql b/backend/store/migration/0001_init_schema.down.sqlindex 09d81abebc..9df575d09f 100644--- a/backend/store/migration/0001_init_schema.down.sql+++ b/backend/store/migration/0001_init_schema.down.sql@@ -26,6 +26,4 @@ DROP TABLE project;DROP TABLE member;-DROP TABLE workspace;-DROP TABLE principal;\ No newline at end of filediff --git a/backend/store/migration/0001_init_schema.up.sql b/backend/store/migration/0001_init_schema.up.sqlindex e9507effd9..d3ae382cb5 100644--- a/backend/store/migration/0001_init_schema.up.sql+++ b/backend/store/migration/0001_init_schema.up.sql@@ -57,56 +57,7 @@ VALUES'');--- workspace--- We only allow a single workspace for on-premise deployment.--- So theoretically speaking, we don't need to create a workspace table.--- But we create this table mostly for preparing a future cloud version--- where we need to support many workspaces and it would be painful to--- introduce workspace table at that time.-CREATE TABLE workspace (- id INTEGER PRIMARY KEY AUTOINCREMENT,- row_status TEXT NOT NULL CHECK (- row_status IN ('NORMAL', 'ARCHIVED', 'PENDING_DELETE')- ) DEFAULT 'NORMAL',- creator_id INTEGER NOT NULL REFERENCES principal (id),- created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- updater_id INTEGER NOT NULL REFERENCES principal (id),- updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- slug TEXT NOT NULL UNIQUE,- name TEXT NOT NULL-);--INSERT INTO- sqlite_sequence (name, seq)-VALUES- ('workspace', 1000);--CREATE TRIGGER IF NOT EXISTS `trigger_update_workspace_modification_time`-AFTER-UPDATE- ON `workspace` FOR EACH ROW BEGIN-UPDATE- `workspace`-SET- updated_ts = (strftime('%s', 'now'))-WHERE- rowid = old.rowid;--END;---- Default workspace for on-premise deployment, id is 1-INSERT INTO- workspace (- id,- creator_id,- updater_id,- slug,- name- )-VALUES- (1, 1, 1, '', 'Default workspace');---- Member table stores the workspace membership+-- MemberCREATE TABLE member (id INTEGER PRIMARY KEY AUTOINCREMENT,row_status TEXT NOT NULL CHECK (@@ -116,12 +67,10 @@ CREATE TABLE member (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),`role` TEXT NOT NULL CHECK (`role` IN ('OWNER', 'DBA', 'DEVELOPER')),- principal_id INTEGER NOT NULL REFERENCES principal (id),- UNIQUE(workspace_id, principal_id)+ principal_id INTEGER NOT NULL REFERENCES principal (id) UNIQUE);INSERT INTO@@ -142,7 +91,7 @@ WHEREEND;--- Environment table stores the workspace environment+-- EnvironmentCREATE TABLE environment (id INTEGER PRIMARY KEY AUTOINCREMENT,row_status TEXT NOT NULL CHECK (@@ -152,10 +101,8 @@ CREATE TABLE environment (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),- name TEXT NOT NULL,- `order` INTEGER NOT NULL,- UNIQUE(workspace_id, name)+ name TEXT NOT NULL UNIQUE,+ `order` INTEGER NOT NULL);INSERT INTO@@ -176,7 +123,7 @@ WHEREEND;--- Project table stores the workspace project+-- ProjectCREATE TABLE project (id INTEGER PRIMARY KEY AUTOINCREMENT,row_status TEXT NOT NULL CHECK (@@ -186,10 +133,8 @@ CREATE TABLE project (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),name TEXT NOT NULL,- `key` TEXT NOT NULL,- UNIQUE(workspace_id, `key`)+ `key` TEXT NOT NULL UNIQUE);INSERT INTO@@ -197,7 +142,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`key`)@@ -206,7 +150,6 @@ VALUES1,1,1,- 1,'Default','DEFAULT');@@ -229,7 +172,7 @@ WHEREEND;--- Project member table stores the workspace project membership+-- Project memberCREATE TABLE project_member (id INTEGER PRIMARY KEY AUTOINCREMENT,row_status TEXT NOT NULL CHECK (@@ -239,11 +182,10 @@ CREATE TABLE project_member (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),project_id INTEGER NOT NULL REFERENCES project (id),`role` TEXT NOT NULL CHECK (`role` IN ('OWNER', 'DEVELOPER')),principal_id INTEGER NOT NULL REFERENCES principal (id),- UNIQUE(workspace_id, project_id, principal_id)+ UNIQUE(project_id, principal_id));INSERT INTO@@ -264,7 +206,7 @@ WHEREEND;--- Instance table stores the workspace instance+-- InstanceCREATE TABLE instance (id INTEGER PRIMARY KEY AUTOINCREMENT,row_status TEXT NOT NULL CHECK (@@ -274,7 +216,6 @@ CREATE TABLE instance (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),environment_id INTEGER NOT NULL REFERENCES environment (id),name TEXT NOT NULL,`engine` TEXT NOT NULL CHECK (`engine` IN ('MYSQL')),@@ -312,7 +253,6 @@ CREATE TABLE db (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),instance_id INTEGER NOT NULL REFERENCES instance (id),project_id INTEGER NOT NULL REFERENCES project (id),name TEXT NOT NULL,@@ -321,7 +261,7 @@ CREATE TABLE db (),last_successful_sync_ts BIGINT NOT NULL,fingerprint TEXT NOT NULL,- UNIQUE(workspace_id, instance_id, name)+ UNIQUE(instance_id, name));INSERT INTO@@ -352,14 +292,13 @@ CREATE TABLE data_source (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),instance_id INTEGER NOT NULL REFERENCES instance (id),database_id INTEGER NOT NULL REFERENCES db (id),name TEXT NOT NULL,`type` TEXT NOT NULL CHECK (TYPE IN ('ADMIN', 'RW', 'RO')),username TEXT NOT NULL,`password` TEXT NOT NULL,- UNIQUE(workspace_id, database_id, name)+ UNIQUE(database_id, name));INSERT INTO@@ -382,7 +321,7 @@ END;------------------------- Pipeline related BEGIN--- pipeline table stores the workspace pipeline+-- pipeline tableCREATE TABLE pipeline (id INTEGER PRIMARY KEY AUTOINCREMENT,row_status TEXT NOT NULL CHECK (@@ -392,7 +331,6 @@ CREATE TABLE pipeline (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),name TEXT NOT NULL,`status` TEXT NOT NULL CHECK (`status` IN ('OPEN', 'DONE', 'CANCELED')));@@ -425,7 +363,6 @@ CREATE TABLE stage (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),pipeline_id INTEGER NOT NULL REFERENCES pipeline (id),environment_id INTEGER NOT NULL REFERENCES environment (id),name TEXT NOT NULL,@@ -460,7 +397,6 @@ CREATE TABLE task (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),pipeline_id INTEGER NOT NULL REFERENCES pipeline (id),stage_id INTEGER NOT NULL REFERENCES stage (id),-- Could be empty for tasks like creating database@@ -505,7 +441,6 @@ CREATE TABLE task_run (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),task_id INTEGER NOT NULL REFERENCES task (id),name TEXT NOT NULL,`status` TEXT NOT NULL CHECK (@@ -541,7 +476,7 @@ END;-- Pipeline related END-------------------------- issue table stores the workspace issue+-- issue-- Each issue links a pipeline driving the resolution.CREATE TABLE issue (id INTEGER PRIMARY KEY AUTOINCREMENT,@@ -552,7 +487,6 @@ CREATE TABLE issue (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),project_id INTEGER NOT NULL REFERENCES project (id),pipeline_id INTEGER NOT NULL REFERENCES pipeline (id),name TEXT NOT NULL,@@ -594,7 +528,6 @@ CREATE TABLE activity (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),container_id INTEGER NOT NULL CHECK (container_id != 0),`type` TEXT NOT NULL CHECK (`type` LIKE 'bb.%'),`comment` TEXT NOT NULL DEFAULT '',@@ -631,10 +564,9 @@ CREATE TABLE bookmark (created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),updater_id INTEGER NOT NULL REFERENCES principal (id),updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),- workspace_id INTEGER NOT NULL REFERENCES workspace (id),name TEXT NOT NULL,link TEXT NOT NULL,- UNIQUE(workspace_id, creator_id, link)+ UNIQUE(creator_id, link));INSERT INTOdiff --git a/backend/store/pipeline.go b/backend/store/pipeline.goindex 9a17d220d4..298d218a33 100644--- a/backend/store/pipeline.go+++ b/backend/store/pipeline.go@@ -93,16 +93,14 @@ func (s *PipelineService) createPipeline(ctx context.Context, tx *Tx, create *apINSERT INTO pipeline (creator_id,updater_id,- workspace_id,name,`+"`status`"+`)- VALUES (?, ?, ?, ?, 'OPEN')- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, `+"`status`"+`+ VALUES (?, ?, ?, 'OPEN')+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, name, `+"`status`"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.Name,)@@ -119,7 +117,6 @@ func (s *PipelineService) createPipeline(ctx context.Context, tx *Tx, create *ap&pipeline.CreatedTs,&pipeline.UpdaterId,&pipeline.UpdatedTs,- &pipeline.WorkspaceId,&pipeline.Name,&pipeline.Status,); err != nil {@@ -135,9 +132,6 @@ func (s *PipelineService) findPipelineList(ctx context.Context, tx *Tx, find *apif v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }rows, err := tx.QueryContext(ctx, `SELECT@@ -146,7 +140,6 @@ func (s *PipelineService) findPipelineList(ctx context.Context, tx *Tx, find *apcreated_ts,updater_id,updated_ts,- workspace_id,name,`+"`status`"+`FROM pipeline@@ -168,7 +161,6 @@ func (s *PipelineService) findPipelineList(ctx context.Context, tx *Tx, find *ap&pipeline.CreatedTs,&pipeline.UpdaterId,&pipeline.UpdatedTs,- &pipeline.WorkspaceId,&pipeline.Name,&pipeline.Status,); err != nil {@@ -199,7 +191,7 @@ func (s *PipelineService) patchPipeline(ctx context.Context, tx *Tx, patch *api.UPDATE pipelineSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, `+"`status`"+`+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, name, `+"`status`"+``,args...,)@@ -216,7 +208,6 @@ func (s *PipelineService) patchPipeline(ctx context.Context, tx *Tx, patch *api.&pipeline.CreatedTs,&pipeline.UpdaterId,&pipeline.UpdatedTs,- &pipeline.WorkspaceId,&pipeline.Name,&pipeline.Status,); err != nil {diff --git a/backend/store/project.go b/backend/store/project.goindex 5a6aae834e..7cd70d9c62 100644--- a/backend/store/project.go+++ b/backend/store/project.go@@ -110,17 +110,15 @@ func createProject(ctx context.Context, tx *Tx, create *api.ProjectCreate) (*apiINSERT INTO project (creator_id,updater_id,- workspace_id,environment_id,name,key)- VALUES (?, ?, ?, ?, ?, ?)- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, `+"`key`"+`+ VALUES (?, ?, ?, ?, ?)+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`key`"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.Name,create.Key,)@@ -139,7 +137,6 @@ func createProject(ctx context.Context, tx *Tx, create *api.ProjectCreate) (*api&project.CreatedTs,&project.UpdaterId,&project.UpdatedTs,- &project.WorkspaceId,&project.Name,&project.Key,); err != nil {@@ -158,9 +155,6 @@ func findProjectList(ctx context.Context, tx *Tx, find *api.ProjectFind) (_ []*aif v := find.RowStatus; v != nil {where, args = append(where, "row_status = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.PrincipalId; v != nil {where, args = append(where, "id IN (SELECT project_id FROM project_member WHERE principal_id = ?)"), append(args, *v)}@@ -173,7 +167,6 @@ func findProjectList(ctx context.Context, tx *Tx, find *api.ProjectFind) (_ []*acreated_ts,updater_id,updated_ts,- workspace_id,name,keyFROM project@@ -196,7 +189,6 @@ func findProjectList(ctx context.Context, tx *Tx, find *api.ProjectFind) (_ []*a&project.CreatedTs,&project.UpdaterId,&project.UpdatedTs,- &project.WorkspaceId,&project.Name,&project.Key,); err != nil {@@ -233,7 +225,7 @@ func patchProject(ctx context.Context, tx *Tx, patch *api.ProjectPatch) (*api.PrUPDATE projectSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, `+"`key`"+`+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`key`"+``,args...,)@@ -251,7 +243,6 @@ func patchProject(ctx context.Context, tx *Tx, patch *api.ProjectPatch) (*api.Pr&project.CreatedTs,&project.UpdaterId,&project.UpdatedTs,- &project.WorkspaceId,&project.Name,&project.Key,); err != nil {diff --git a/backend/store/project_member.go b/backend/store/project_member.goindex 83633105ce..8981714507 100644--- a/backend/store/project_member.go+++ b/backend/store/project_member.go@@ -131,17 +131,15 @@ func createProjectMember(ctx context.Context, tx *Tx, create *api.ProjectMemberCINSERT INTO project_member (creator_id,updater_id,- workspace_id,project_id,`+"`role`,"+`principal_id)- VALUES (?, ?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, project_id, role, principal_id+ VALUES (?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, role, principal_id`,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.ProjectId,create.Role,create.PrincipalId,@@ -160,7 +158,6 @@ func createProjectMember(ctx context.Context, tx *Tx, create *api.ProjectMemberC&projectMember.CreatedTs,&projectMember.UpdaterId,&projectMember.UpdatedTs,- &projectMember.WorkspaceId,&projectMember.ProjectId,&projectMember.Role,&projectMember.PrincipalId,@@ -177,9 +174,6 @@ func findProjectMemberList(ctx context.Context, tx *Tx, find *api.ProjectMemberFif v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.ProjectId; v != nil {where, args = append(where, "project_id = ?"), append(args, *v)}@@ -191,7 +185,6 @@ func findProjectMemberList(ctx context.Context, tx *Tx, find *api.ProjectMemberFcreated_ts,updater_id,updated_ts,- workspace_id,project_id,role,principal_id@@ -214,7 +207,6 @@ func findProjectMemberList(ctx context.Context, tx *Tx, find *api.ProjectMemberF&projectMember.CreatedTs,&projectMember.UpdaterId,&projectMember.UpdatedTs,- &projectMember.WorkspaceId,&projectMember.ProjectId,&projectMember.Role,&projectMember.PrincipalId,@@ -246,7 +238,7 @@ func patchProjectMember(ctx context.Context, tx *Tx, patch *api.ProjectMemberPatUPDATE project_memberSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, project_id, role, principal_id+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, role, principal_id`,args...,)@@ -263,7 +255,6 @@ func patchProjectMember(ctx context.Context, tx *Tx, patch *api.ProjectMemberPat&projectMember.CreatedTs,&projectMember.UpdaterId,&projectMember.UpdatedTs,- &projectMember.WorkspaceId,&projectMember.ProjectId,&projectMember.Role,&projectMember.PrincipalId,diff --git a/backend/store/seed/0001_principal.sql b/backend/store/seed/0001_principal.sqlindex 37360b7562..3c098bdfaf 100644--- a/backend/store/seed/0001_principal.sql+++ b/backend/store/seed/0001_principal.sql@@ -1,5 +1,6 @@-- End user id starts at 1001, we reserve the range between 1 ~ 1000 for internal use.-- Setting the id explicitly changes the next id value to be +1+-- 1001INSERT INTOprincipal (creator_id,@@ -22,6 +23,7 @@ VALUES'$2a$10$/65QFlHOmDzXshEMt/qYuunbJrXtRLcaYDcRODbyOPa/9/N0N8Zc2');+-- 1002INSERT INTOprincipal (creator_id,@@ -44,6 +46,7 @@ VALUES'$2a$10$a.o5.ELPUO8PKYGuWTSDseOqNssImU2b9qFgBaDKI7CKAKIhQYVfG');+-- 1003INSERT INTOprincipal (creator_id,@@ -66,28 +69,7 @@ VALUES'$2a$10$cB0QuMqG0Bmz/j1LDI2gXOqUXtp.Yd87zRus6zxR026RyiyuWeJye');-INSERT INTO- principal (- creator_id,- updater_id,- `status`,- `type`,- name,- email,- password_hash- )-VALUES- (- 1,- 1,- 'ACTIVE',- 'END_USER',- 'Alice DBA',- '[email protected]',- -- aaa- '$2a$10$pbkq/3m/AJ.rE8.6G/.Moez5Ld6dIaFKRtnsHNtYofHjupWWP/6YW'- );-+-- 1004INSERT INTOprincipal (creator_id,diff --git a/backend/store/seed/0010_workspace.sql b/backend/store/seed/0010_workspace.sqlindex 4f2547acae..e2c27b7230 100644--- a/backend/store/seed/0010_workspace.sql+++ b/backend/store/seed/0010_workspace.sql@@ -1,12 +1 @@--- Insert a second workspace for testing purpose to make sure we don't--- advertently return data from a different workspace.-INSERT INTO- workspace (- creator_id,- updater_id,- row_status,- slug,- name- )-VALUES- (1, 1, 'NORMAL', 'ws2', 'Workspace2');\ No newline at end of file+-- 0010 is reserved for workspace, but is not implemented yet.\ No newline at end of filediff --git a/backend/store/seed/0020_member.sql b/backend/store/seed/0020_member.sqlindex 766a54cd27..180209b80b 100644--- a/backend/store/seed/0020_member.sql+++ b/backend/store/seed/0020_member.sql@@ -1,71 +1,43 @@INSERT INTOmember (id,- workspace_id,creator_id,updater_id,role,principal_id)VALUES- (2001, 1, 1001, 1001, 'OWNER', 1001);+ (2001, 1001, 1001, 'OWNER', 1001);INSERT INTOmember (id,creator_id,updater_id,- workspace_id,role,principal_id)VALUES- (2002, 1001, 1001, 1, 'DBA', 1002);+ (2002, 1001, 1001, 'DBA', 1002);INSERT INTOmember (id,creator_id,updater_id,- workspace_id,role,principal_id)VALUES- (2003, 1001, 1001, 1, 'DEVELOPER', 1003);+ (2003, 1001, 1001, 'DEVELOPER', 1003);INSERT INTOmember (id,creator_id,updater_id,- workspace_id,role,principal_id)VALUES- (2004, 1001, 1001, 1, 'DEVELOPER', 1005);--INSERT INTO- member (- id,- creator_id,- updater_id,- workspace_id,- role,- principal_id- )-VALUES- (102001, 1001, 1001, 1001, 'OWNER', 1001);--INSERT INTO- member (- id,- creator_id,- updater_id,- workspace_id,- role,- principal_id- )-VALUES- (102002, 1001, 1001, 1001, 'DBA', 1004);\ No newline at end of file+ (2004, 1001, 1001, 'DEVELOPER', 1004);\ No newline at end of filediff --git a/backend/store/seed/0030_project.sql b/backend/store/seed/0030_project.sqlindex b70fa54bd7..0a250d0ec7 100644--- a/backend/store/seed/0030_project.sql+++ b/backend/store/seed/0030_project.sql@@ -3,7 +3,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`key`)@@ -12,7 +11,6 @@ VALUES3001,1001,1001,- 1,'project 1','PRJ1');@@ -22,7 +20,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`key`)@@ -31,7 +28,6 @@ VALUES3002,1001,1001,- 1,'project 2','PRJ2');@@ -41,7 +37,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`key`)@@ -50,7 +45,6 @@ VALUES3003,1001,1001,- 1,'project 3','PRJ3');@@ -60,7 +54,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`key`)@@ -69,7 +62,6 @@ VALUES3004,1001,1001,- 1,'project 4','PRJ4');@@ -80,7 +72,6 @@ INSERT INTOrow_status,creator_id,updater_id,- workspace_id,name,`key`)@@ -90,26 +81,6 @@ VALUES'ARCHIVED',1001,1001,- 1,'project 5','PRJ5'- );--INSERT INTO- project (- id,- creator_id,- updater_id,- workspace_id,- name,- `key`- )-VALUES- (- 3006,- 1001,- 1001,- 1001,- 'ws2 project 1',- 'PRJ1');\ No newline at end of filediff --git a/backend/store/seed/0040_project_member.sql b/backend/store/seed/0040_project_member.sqlindex 7665c46fa5..02102ed108 100644--- a/backend/store/seed/0040_project_member.sql+++ b/backend/store/seed/0040_project_member.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -14,7 +13,6 @@ VALUES4001,1001,1001,- 1,3001,'OWNER',1002@@ -25,7 +23,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -35,7 +32,6 @@ VALUES4002,1001,1001,- 1,3001,'DEVELOPER',1001@@ -46,7 +42,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -56,7 +51,6 @@ VALUES4003,1001,1001,- 1,3001,'DEVELOPER',1003@@ -68,7 +62,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -78,7 +71,6 @@ VALUES4004,1001,1001,- 1,3002,'OWNER',1003@@ -89,7 +81,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -99,7 +90,6 @@ VALUES4005,1001,1001,- 1,3002,'DEVELOPER',1002@@ -111,7 +101,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -121,7 +110,6 @@ VALUES4006,1001,1001,- 1,3003,'OWNER',1002@@ -132,7 +120,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -142,7 +129,6 @@ VALUES4007,1001,1001,- 1,3003,'DEVELOPER',1001@@ -154,7 +140,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -164,7 +149,6 @@ VALUES4008,1001,1001,- 1,3004,'OWNER',1002@@ -175,7 +159,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -185,7 +168,6 @@ VALUES4009,1001,1001,- 1,3004,'DEVELOPER',1001@@ -197,7 +179,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -207,7 +188,6 @@ VALUES4010,1001,1001,- 1,3005,'OWNER',1001@@ -218,7 +198,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,`role`,principal_id@@ -228,7 +207,6 @@ VALUES4011,1001,1001,- 1,3005,'DEVELOPER',1003diff --git a/backend/store/seed/0050_environment.sql b/backend/store/seed/0050_environment.sqlindex 15e2bc2ecb..ea97113aab 100644--- a/backend/store/seed/0050_environment.sql+++ b/backend/store/seed/0050_environment.sql@@ -3,7 +3,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`order`)@@ -12,7 +11,6 @@ VALUES5001,1001,1001,- 1,'Sandbox A',0);@@ -22,7 +20,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`order`)@@ -31,7 +28,6 @@ VALUES5002,1001,1001,- 1,'Integration',1);@@ -41,7 +37,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`order`)@@ -50,7 +45,6 @@ VALUES5003,1001,1001,- 1,'Staging',2);@@ -60,7 +54,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`order`)@@ -69,7 +62,6 @@ VALUES5004,1001,1001,- 1,'Prod',3);@@ -80,7 +72,6 @@ INSERT INTOrow_status,creator_id,updater_id,- workspace_id,name,`order`)@@ -90,7 +81,6 @@ VALUES'ARCHIVED',1001,1001,- 1,'Archived Env 1',4);\ No newline at end of filediff --git a/backend/store/seed/0060_instance.sql b/backend/store/seed/0060_instance.sqlindex 2d9e6e8819..5efb9762b5 100644--- a/backend/store/seed/0060_instance.sql+++ b/backend/store/seed/0060_instance.sql@@ -3,7 +3,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,environment_id,name,`engine`,@@ -16,7 +15,6 @@ VALUES6001,1001,1001,- 1,5001,'On-premise MySQL instance','MYSQL',@@ -30,7 +28,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,environment_id,name,`engine`,@@ -43,7 +40,6 @@ VALUES6002,1001,1001,- 1,5002,'AWS RDS instance','MYSQL',@@ -57,7 +53,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,environment_id,name,`engine`,@@ -70,7 +65,6 @@ VALUES6003,1001,1001,- 1,5003,'GCP Cloud SQL instance','MYSQL',@@ -84,7 +78,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,environment_id,name,`engine`,@@ -97,7 +90,6 @@ VALUES6004,1001,1001,- 1,5004,'Azure SQL instance','MYSQL',@@ -111,7 +103,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,environment_id,name,`engine`,@@ -124,7 +115,6 @@ VALUES6005,1001,1001,- 1,5004,'AliCloud RDS instance','MYSQL',diff --git a/backend/store/seed/0070_database.sql b/backend/store/seed/0070_database.sqlindex 6b2226178a..155f46eb6b 100644--- a/backend/store/seed/0070_database.sql+++ b/backend/store/seed/0070_database.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -17,7 +16,6 @@ VALUES7001,1001,1001,- 1,6001,1,'*',@@ -31,7 +29,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -44,7 +41,6 @@ VALUES7002,1001,1001,- 1,6002,3001,'fakedb1',@@ -59,7 +55,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -72,7 +67,6 @@ VALUES7003,1001,1001,- 1,6002,1,'*',@@ -86,7 +80,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -99,7 +92,6 @@ VALUES7004,1001,1001,- 1,6002,3002,'fakedb2',@@ -114,7 +106,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -127,7 +118,6 @@ VALUES7005,1001,1001,- 1,6003,1,'*',@@ -141,7 +131,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -154,7 +143,6 @@ VALUES7006,1001,1001,- 1,6003,3003,'fakedb3',@@ -169,7 +157,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -182,7 +169,6 @@ VALUES7007,1001,1001,- 1,6004,1,'*',@@ -196,7 +182,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -209,7 +194,6 @@ VALUES7008,1001,1001,- 1,6004,3004,'fakedb4',@@ -224,7 +208,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -237,7 +220,6 @@ VALUES7009,1001,1001,- 1,6005,1,'*',@@ -251,7 +233,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,project_id,name,@@ -264,7 +245,6 @@ VALUES7010,1001,1001,- 1,6005,3005,'fakedb5',diff --git a/backend/store/seed/0080_data_source.sql b/backend/store/seed/0080_data_source.sqlindex 26b3bf3270..e25efc1b29 100644--- a/backend/store/seed/0080_data_source.sql+++ b/backend/store/seed/0080_data_source.sql@@ -3,7 +3,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,database_id,name,@@ -16,7 +15,6 @@ VALUES8001,1,1,- 1,6001,7001,'Admin data source',@@ -30,7 +28,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,database_id,name,@@ -43,7 +40,6 @@ VALUES8002,1,1,- 1,6002,7002,'Admin data source',@@ -57,7 +53,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,database_id,name,@@ -70,7 +65,6 @@ VALUES8003,1,1,- 1,6003,7003,'Admin data source',@@ -84,7 +78,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,database_id,name,@@ -97,7 +90,6 @@ VALUES8004,1,1,- 1,6004,7004,'Admin data source',@@ -111,7 +103,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,instance_id,database_id,name,@@ -124,7 +115,6 @@ VALUES8005,1,1,- 1,6005,7005,'Admin data source',diff --git a/backend/store/seed/0090_pipeline.sql b/backend/store/seed/0090_pipeline.sqlindex 4d06aba5fc..691d79465c 100644--- a/backend/store/seed/0090_pipeline.sql+++ b/backend/store/seed/0090_pipeline.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`status`)@@ -13,7 +12,6 @@ VALUES9001,1001,1001,- 1,'Pipeline - Hello world','OPEN');@@ -24,7 +22,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`status`)@@ -33,7 +30,6 @@ VALUES9002,1003,1003,- 1,'Pipeline - Add column ''location'' to table ''warehouse''','OPEN');@@ -44,7 +40,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,name,`status`)@@ -53,7 +48,6 @@ VALUES9003,1003,1003,- 1,'Pipeline - Create table ''tbl1''','OPEN');\ No newline at end of filediff --git a/backend/store/seed/0100_stage.sql b/backend/store/seed/0100_stage.sqlindex a00968f425..65ec7990c6 100644--- a/backend/store/seed/0100_stage.sql+++ b/backend/store/seed/0100_stage.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,@@ -15,7 +14,6 @@ VALUES10001,1001,1001,- 1,9001,5004,'Prod',@@ -28,7 +26,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,@@ -39,7 +36,6 @@ VALUES10002,1003,1003,- 1,9002,5001,'Sandbox A',@@ -51,7 +47,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,@@ -62,7 +57,6 @@ VALUES10003,1003,1003,- 1,9002,5002,'Integration',@@ -74,7 +68,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,@@ -85,7 +78,6 @@ VALUES10004,1003,1003,- 1,9002,5003,'Staging',@@ -97,7 +89,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,@@ -108,7 +99,6 @@ VALUES10005,1003,1003,- 1,9002,5004,'Prod',@@ -121,7 +111,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,@@ -132,7 +121,6 @@ VALUES10006,1003,1003,- 1,9003,5001,'Sandbox A',@@ -144,7 +132,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,@@ -155,7 +142,6 @@ VALUES10007,1003,1003,- 1,9003,5002,'Integration',diff --git a/backend/store/seed/0110_task.sql b/backend/store/seed/0110_task.sqlindex 2c7e6c0d60..5148b7ca30 100644--- a/backend/store/seed/0110_task.sql+++ b/backend/store/seed/0110_task.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -18,7 +17,6 @@ VALUES11001,1001,1001,- 1,9001,10001,7008,@@ -35,7 +33,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -48,7 +45,6 @@ VALUES11002,1003,1003,- 1,9002,10002,7002,@@ -63,7 +59,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -76,7 +71,6 @@ VALUES11003,1003,1003,- 1,9002,10003,7004,@@ -91,7 +85,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -104,7 +97,6 @@ VALUES11004,1003,1003,- 1,9002,10004,7006,@@ -119,7 +111,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -132,7 +123,6 @@ VALUES11005,1003,1003,- 1,9002,10005,7008,@@ -148,7 +138,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -161,7 +150,6 @@ VALUES11006,1003,1003,- 1,9003,10006,7002,@@ -176,7 +164,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -189,7 +176,6 @@ VALUES11007,1003,1003,- 1,9003,10007,7004,diff --git a/backend/store/seed/0120_task_run.sql b/backend/store/seed/0120_task_run.sqlindex db01631acc..2724e61084 100644--- a/backend/store/seed/0120_task_run.sql+++ b/backend/store/seed/0120_task_run.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,task_id,name,`status`,@@ -15,7 +14,6 @@ VALUES12001,1003,1003,- 1,11006,'UPDATE fakedb1 task run','FAILED',diff --git a/backend/store/seed/0130_issue.sql b/backend/store/seed/0130_issue.sqlindex 3785b20408..841d906b35 100644--- a/backend/store/seed/0130_issue.sql+++ b/backend/store/seed/0130_issue.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,pipeline_id,name,@@ -20,7 +19,6 @@ VALUES13001,1002,1002,- 1,3001,9001,'Hello world!',@@ -38,7 +36,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,pipeline_id,name,@@ -55,7 +52,6 @@ VALUES13002,1003,1003,- 1,3002,9002,'Add column ''location'' to table ''warehouse''',@@ -74,7 +70,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,project_id,pipeline_id,name,@@ -91,7 +86,6 @@ VALUES13003,1003,1003,- 1,3002,9003,'Create a new table ''tbl1''',diff --git a/backend/store/seed/0140_activity.sql b/backend/store/seed/0140_activity.sqlindex 9c11b2ea54..41fdeb7147 100644--- a/backend/store/seed/0140_activity.sql+++ b/backend/store/seed/0140_activity.sql@@ -4,7 +4,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,container_id,`type`)@@ -13,7 +12,6 @@ VALUES14001,1,1,- 1,13001,'bb.issue.create');@@ -23,7 +21,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,container_id,`type`,`comment`@@ -33,7 +30,6 @@ VALUES14002,1001,1001,- 1,13001,'bb.issue.comment.create','Welcome!'@@ -44,7 +40,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,container_id,`type`,`comment`@@ -54,7 +49,6 @@ VALUES14003,1002,1002,- 1,13001,'bb.issue.comment.create','Let''s rock!'@@ -65,7 +59,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,container_id,`type`,`comment`@@ -75,7 +68,6 @@ VALUES14004,1003,1003,- 1,13001,'bb.issue.comment.create','Go fish!'@@ -87,7 +79,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,container_id,`type`)@@ -96,7 +87,6 @@ VALUES14005,1003,1003,- 1,13002,'bb.issue.create');@@ -107,7 +97,6 @@ INSERT INTOid,creator_id,updater_id,- workspace_id,container_id,`type`)@@ -116,7 +105,6 @@ VALUES14006,1003,1003,- 1,13003,'bb.issue.create');\ No newline at end of filediff --git a/backend/store/sqlite.go b/backend/store/sqlite.goindex 8017925751..82698758fd 100644--- a/backend/store/sqlite.go+++ b/backend/store/sqlite.go@@ -242,21 +242,19 @@ func FormatError(err error) error {switch err.Error() {case "UNIQUE constraint failed: principal.email":return bytebase.Errorf(bytebase.ECONFLICT, "email already exists")- case "UNIQUE constraint failed: workspace.slug":- return bytebase.Errorf(bytebase.ECONFLICT, "workspace slug already exists")- case "UNIQUE constraint failed: member.workspace_id, member.principal_id":+ case "UNIQUE constraint failed: member.principal_id":return bytebase.Errorf(bytebase.ECONFLICT, "member already exists")- case "UNIQUE constraint failed: environment.workspace_id, environment.name":+ case "UNIQUE constraint failed: environment.name":return bytebase.Errorf(bytebase.ECONFLICT, "environment name already exists")- case "UNIQUE constraint failed: project.workspace_id, project.key":+ case "UNIQUE constraint failed: project.key":return bytebase.Errorf(bytebase.ECONFLICT, "project key already exists")- case "UNIQUE constraint failed: project_member.workspace_id, project_member.project_id, project_member.principal_id":+ case "UNIQUE constraint failed: project_member.project_id, project_member.principal_id":return bytebase.Errorf(bytebase.ECONFLICT, "project member already exists")- case "UNIQUE constraint failed: db.workspace_id, db.instance_id, db.name":+ case "UNIQUE constraint failed: db.instance_id, db.name":return bytebase.Errorf(bytebase.ECONFLICT, "database name already exists")- case "UNIQUE constraint failed: data_source.workspace_id, data_source.instance_id, data_source.name":+ case "UNIQUE constraint failed: data_source.instance_id, data_source.name":return bytebase.Errorf(bytebase.ECONFLICT, "data source name already exists")- case "UNIQUE constraint failed: bookmark.workspace_id, bookmark.creator_id, bookmark.link":+ case "UNIQUE constraint failed: bookmark.creator_id, bookmark.link":return bytebase.Errorf(bytebase.ECONFLICT, "bookmark already exists")default:return errdiff --git a/backend/store/stage.go b/backend/store/stage.goindex f96b08a408..52751df3b8 100644--- a/backend/store/stage.go+++ b/backend/store/stage.go@@ -88,18 +88,16 @@ func (s *StageService) createStage(ctx context.Context, tx *Tx, create *api.StagINSERT INTO stage (creator_id,updater_id,- workspace_id,pipeline_id,environment_id,name,`+"`type`"+`)- VALUES (?, ?, ?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, pipeline_id, environment_id, name, `+"`type`"+`+ VALUES (?, ?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, environment_id, name, `+"`type`"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.PipelineId,create.EnvironmentId,create.Name,@@ -119,7 +117,6 @@ func (s *StageService) createStage(ctx context.Context, tx *Tx, create *api.Stag&stage.CreatedTs,&stage.UpdaterId,&stage.UpdatedTs,- &stage.WorkspaceId,&stage.PipelineId,&stage.EnvironmentId,&stage.Name,@@ -137,9 +134,6 @@ func (s *StageService) findStageList(ctx context.Context, tx *Tx, find *api.Stagif v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.PipelineId; v != nil {where, args = append(where, "pipeline_id = ?"), append(args, *v)}@@ -151,7 +145,6 @@ func (s *StageService) findStageList(ctx context.Context, tx *Tx, find *api.Stagcreated_ts,updater_id,updated_ts,- workspace_id,pipeline_id,environment_id,name,@@ -175,7 +168,6 @@ func (s *StageService) findStageList(ctx context.Context, tx *Tx, find *api.Stag&stage.CreatedTs,&stage.UpdaterId,&stage.UpdatedTs,- &stage.WorkspaceId,&stage.PipelineId,&stage.EnvironmentId,&stage.Name,diff --git a/backend/store/task.go b/backend/store/task.goindex 7ecfcddb3c..fc686504ac 100644--- a/backend/store/task.go+++ b/backend/store/task.go@@ -104,7 +104,6 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCrINSERT INTO task (creator_id,updater_id,- workspace_id,pipeline_id,stage_id,database_id,@@ -113,12 +112,11 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCr`+"`type`,"+`payload)- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, pipeline_id, stage_id, database_id, name, `+"`status`, `type`, payload"+`+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, stage_id, database_id, name, `+"`status`, `type`, payload"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.PipelineId,create.StageId,create.DatabaseId,@@ -142,7 +140,6 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCr&task.CreatedTs,&task.UpdaterId,&task.UpdatedTs,- &task.WorkspaceId,&task.PipelineId,&task.StageId,&task.DatabaseId,@@ -175,9 +172,6 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFiif v := find.ID; v != nil {where, args = append(where, "id = ?"), append(args, *v)}- if v := find.WorkspaceId; v != nil {- where, args = append(where, "workspace_id = ?"), append(args, *v)- }if v := find.PipelineId; v != nil {where, args = append(where, "pipeline_id = ?"), append(args, *v)}@@ -195,7 +189,6 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFicreated_ts,updater_id,updated_ts,- workspace_id,pipeline_id,stage_id,database_id,@@ -222,7 +215,6 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFi&task.CreatedTs,&task.UpdaterId,&task.UpdatedTs,- &task.WorkspaceId,&task.PipelineId,&task.StageId,&task.DatabaseId,@@ -285,12 +277,11 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Taif patch.Status == api.TaskRunning {taskRunCreate := &api.TaskRunCreate{- CreatorId: patch.UpdaterId,- WorkspaceId: api.DEFAULT_WORKPSACE_ID,- TaskId: task.ID,- Name: fmt.Sprintf("%s %d", task.Name, time.Now().Unix()),- Type: task.Type,- Payload: task.Payload,+ CreatorId: patch.UpdaterId,+ TaskId: task.ID,+ Name: fmt.Sprintf("%s %d", task.Name, time.Now().Unix()),+ Type: task.Type,+ Payload: task.Payload,}if _, err := s.TaskRunService.CreateTaskRun(ctx, tx.Tx, taskRunCreate); err != nil {return nil, err@@ -327,7 +318,7 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.TaUPDATE taskSET `+strings.Join(set, ", ")+`WHERE id = ?- RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, pipeline_id, stage_id, database_id, name, `+"`status`, `type`, payload"+`+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, stage_id, database_id, name, `+"`status`, `type`, payload"+``,args...,)@@ -344,7 +335,6 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta&task.CreatedTs,&task.UpdaterId,&task.UpdatedTs,- &task.WorkspaceId,&task.PipelineId,&task.StageId,&task.DatabaseId,diff --git a/backend/store/task_run.go b/backend/store/task_run.goindex 022b4a53ff..9426aa8aeb 100644--- a/backend/store/task_run.go+++ b/backend/store/task_run.go@@ -32,19 +32,17 @@ func (s *TaskRunService) CreateTaskRun(ctx context.Context, tx *sql.Tx, create *INSERT INTO task_run (creator_id,updater_id,- workspace_id,task_id,name,`+"`status`,"+``+"`type`,"+`payload)- VALUES (?, ?, ?, ?, ?, 'RUNNING', ?, ?)+ VALUES (?, ?, ?, ?, 'RUNNING', ?, ?)RETURNING id, creator_id, created_ts, updater_id, updated_ts, task_id, name, `+"`status`, `type`, payload"+``,create.CreatorId,create.CreatorId,- create.WorkspaceId,create.TaskId,create.Name,create.Type,