Skip to content

Commit

Permalink
Merge pull request #2134 from actiontech/issue-1229-5
Browse files Browse the repository at this point in the history
Add SqlManageEndpoint model
  • Loading branch information
ColdWaterLW authored Dec 7, 2023
2 parents 05e0469 + 0f3cbf4 commit 73e86ef
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions sqle/api/controller/v1/sql_manage.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ type Source struct {
SqlAuditRecordIds []string `json:"sql_audit_record_ids"`
}

// todo : 该接口已废弃,后续会删除
// GetSqlManageList
// @Deprecated
// @Summary 获取管控sql列表
// @Description get sql manage list
// @Tags SqlManage
Expand Down
13 changes: 13 additions & 0 deletions sqle/api/controller/v2/sql_manage_ce.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build !enterprise
// +build !enterprise

package v2

import (
v1 "github.com/actiontech/sqle/sqle/api/controller/v1"
"github.com/labstack/echo/v4"
)

func getSqlManageList(c echo.Context) error {
return v1.ErrCommunityEditionNotSupportSqlManage
}
7 changes: 0 additions & 7 deletions sqle/api/controller/v2/sql_manager_ce.go

This file was deleted.

1 change: 1 addition & 0 deletions sqle/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4736,6 +4736,7 @@ var doc = `{
],
"summary": "获取管控sql列表",
"operationId": "GetSqlManageList",
"deprecated": true,
"parameters": [
{
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions sqle/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4720,6 +4720,7 @@
],
"summary": "获取管控sql列表",
"operationId": "GetSqlManageList",
"deprecated": true,
"parameters": [
{
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions sqle/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8162,6 +8162,7 @@ paths:
- sql_audit_record
/v1/projects/{project_name}/sql_manages:
get:
deprecated: true
description: get sql manage list
operationId: GetSqlManageList
parameters:
Expand Down
10 changes: 10 additions & 0 deletions sqle/model/sql_manage.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,13 @@ type SqlManageSqlAuditRecord struct {
func (sm SqlManageSqlAuditRecord) TableName() string {
return "sql_manage_sql_audit_records"
}

type SqlManageEndpoint struct {
Model
ProjFpSourceInstSchemaMd5 string `json:"proj_fp_source_inst_schema_md5" gorm:"unique_index:uniq_md5_endpoint;"`
Endpoint string `json:"endpoint" gorm:"unique_index:uniq_md5_endpoint;"`
}

func (sm SqlManageEndpoint) TableName() string {
return "sql_manage_endpoints"
}
1 change: 1 addition & 0 deletions sqle/model/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ var autoMigrateList = []interface{}{
&SqlManageSqlAuditRecord{},
&BlackListAuditPlanSQL{},
&CompanyNotice{},
&SqlManageEndpoint{},
}

func (s *Storage) AutoMigrate() error {
Expand Down

0 comments on commit 73e86ef

Please sign in to comment.