Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql version manage #2670

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions sqle/api/controller/v1/sql_version_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,55 @@

package v1

import "github.com/labstack/echo/v4"
import (
e "errors"

"github.com/actiontech/sqle/sqle/errors"
"github.com/labstack/echo/v4"
)

var ErrCommunityEditionNotSupportSqlVersion = errors.New(errors.EnterpriseEditionFeatures, e.New("sql version is enterprise version feature"))

func createSqlVersion(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func getSqlVersionList(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func getSqlVersionDetail(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func updateSqlVersion(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func lockSqlVersion(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func deleteSqlVersion(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func getDependenciesBetweenStageInstance(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func batchReleaseWorkflows(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func batchExecuteWorkflows(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func batchAssociateWorkflowsWithVersion(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}

func getWorkflowsThatCanBeAssociatedToVersion(c echo.Context) error {
return ErrCommunityEditionNotSupportSqlManage
return ErrCommunityEditionNotSupportSqlVersion
}
14 changes: 11 additions & 3 deletions sqle/api/controller/v2/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ type WorkflowResV2 struct {
ExecMode string `json:"exec_mode" enums:"sql_file,sqls"`
CreateUser string `json:"create_user_name"`
CreateTime *time.Time `json:"create_time"`
SqlVersionName string `json:"sql_version_name"`
SqlVersion *SqlVersion `json:"sql_version,omitempty"`
Record *WorkflowRecordResV2 `json:"record"`
RecordHistory []*WorkflowRecordResV2 `json:"record_history_list,omitempty"`
AssociatedStageWorkflows []*AssociatedStageWorkflows `json:"associated_stage_workflows,omitempty"`
Expand All @@ -1159,6 +1159,11 @@ type AssociatedStageWorkflows struct {
StageSequence int `json:"stage_sequence"`
}

type SqlVersion struct {
SqlVersionName string `json:"sql_version_name"`
SqlVersionId uint `json:"sql_version_id"`
}

// GetWorkflowV2
// @Summary 获取工单详情
// @Description get workflow detail
Expand Down Expand Up @@ -1230,13 +1235,16 @@ func convertWorkflowToRes(workflow *model.Workflow, sqlVersion *model.SqlVersion
WorkflowID: workflow.WorkflowId,
Desc: workflow.Desc,
Mode: workflow.Mode,
SqlVersionName: sqlVersion.Version,
ExecMode: workflow.ExecMode,
CreateUser: dms.GetUserNameWithDelTag(workflow.CreateUserId),
CreateTime: &workflow.CreatedAt,
AssociatedStageWorkflows: convertAssociatedWorkflowToRes(associatedWorkflows),
}

sqlVersionRes := &SqlVersion{
SqlVersionId: sqlVersion.ID,
SqlVersionName: sqlVersion.Version,
}
workflowRes.SqlVersion = sqlVersionRes
// convert workflow record
workflowRecordRes := convertWorkflowRecordToRes(workflow, workflow.Record)

Expand Down
16 changes: 14 additions & 2 deletions sqle/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18252,6 +18252,17 @@ var doc = `{
}
}
},
"v2.SqlVersion": {
"type": "object",
"properties": {
"sql_version_id": {
"type": "integer"
},
"sql_version_name": {
"type": "string"
}
}
},
"v2.TableMetas": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -18403,8 +18414,9 @@ var doc = `{
"$ref": "#/definitions/v2.WorkflowRecordResV2"
}
},
"sql_version_name": {
"type": "string"
"sql_version": {
"type": "object",
"$ref": "#/definitions/v2.SqlVersion"
},
"workflow_id": {
"type": "string"
Expand Down
16 changes: 14 additions & 2 deletions sqle/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -18236,6 +18236,17 @@
}
}
},
"v2.SqlVersion": {
"type": "object",
"properties": {
"sql_version_id": {
"type": "integer"
},
"sql_version_name": {
"type": "string"
}
}
},
"v2.TableMetas": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -18387,8 +18398,9 @@
"$ref": "#/definitions/v2.WorkflowRecordResV2"
}
},
"sql_version_name": {
"type": "string"
"sql_version": {
"type": "object",
"$ref": "#/definitions/v2.SqlVersion"
},
"workflow_id": {
"type": "string"
Expand Down
12 changes: 10 additions & 2 deletions sqle/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5332,6 +5332,13 @@ definitions:
- manual_audited
type: string
type: object
v2.SqlVersion:
properties:
sql_version_id:
type: integer
sql_version_name:
type: string
type: object
v2.TableMetas:
properties:
err_message:
Expand Down Expand Up @@ -5435,8 +5442,9 @@ definitions:
items:
$ref: '#/definitions/v2.WorkflowRecordResV2'
type: array
sql_version_name:
type: string
sql_version:
$ref: '#/definitions/v2.SqlVersion'
type: object
workflow_id:
type: string
workflow_name:
Expand Down
Loading