Skip to content

Commit

Permalink
Merge pull request #2739 from actiontech/database_comparison_api
Browse files Browse the repository at this point in the history
Database comparison api
  • Loading branch information
taolx0 authored Nov 7, 2024
2 parents 60a384c + 6f07737 commit d4930d3
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 9 deletions.
12 changes: 9 additions & 3 deletions sqle/api/controller/v1/database_compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,18 @@ type DatabaseComparisonStatementsResV1 struct {
}

type DatabaseComparisonStatements struct {
BaseSQL *SQLStatementWithAuditResult `json:"base_sql"`
ComparisondSQL *SQLStatementWithAuditResult `json:"comparison_sql"`
BaseSQL *SQLStatement `json:"base_sql"`
ComparisondSQL *SQLStatement `json:"comparison_sql"`
}

type SQLStatement struct {
AuditError string `json:"audit_error,omitempty"`
SQLStatementWithAudit *SQLStatementWithAuditResult `json:"sql_statement_with_audit"`
}

type SQLStatementWithAuditResult struct {
SQLStatement string `json:"sql_statement"`
AuditResults []*SQLAuditResult `json:"audit_results"`
AuditResults []*SQLAuditResult `json:"audit_results,omitempty"`
}

type SQLAuditResult struct {
Expand Down Expand Up @@ -122,6 +127,7 @@ type GenModifySQLResV1 struct {
type DatabaseDiffModifySQL struct {
SchemaName string `json:"schema_name"`
ModifySQLs []*SQLStatementWithAuditResult `json:"modify_sqls"`
AuditError string `json:"audit_error,omitempty"`
}

// @Summary 生成变更SQL
Expand Down
19 changes: 17 additions & 2 deletions sqle/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12219,11 +12219,11 @@ var doc = `{
"properties": {
"base_sql": {
"type": "object",
"$ref": "#/definitions/v1.SQLStatementWithAuditResult"
"$ref": "#/definitions/v1.SQLStatement"
},
"comparison_sql": {
"type": "object",
"$ref": "#/definitions/v1.SQLStatementWithAuditResult"
"$ref": "#/definitions/v1.SQLStatement"
}
}
},
Expand All @@ -12247,6 +12247,9 @@ var doc = `{
"v1.DatabaseDiffModifySQL": {
"type": "object",
"properties": {
"audit_error": {
"type": "string"
},
"modify_sqls": {
"type": "array",
"items": {
Expand Down Expand Up @@ -16104,6 +16107,18 @@ var doc = `{
}
}
},
"v1.SQLStatement": {
"type": "object",
"properties": {
"audit_error": {
"type": "string"
},
"sql_statement_with_audit": {
"type": "object",
"$ref": "#/definitions/v1.SQLStatementWithAuditResult"
}
}
},
"v1.SQLStatementWithAuditResult": {
"type": "object",
"properties": {
Expand Down
19 changes: 17 additions & 2 deletions sqle/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -12203,11 +12203,11 @@
"properties": {
"base_sql": {
"type": "object",
"$ref": "#/definitions/v1.SQLStatementWithAuditResult"
"$ref": "#/definitions/v1.SQLStatement"
},
"comparison_sql": {
"type": "object",
"$ref": "#/definitions/v1.SQLStatementWithAuditResult"
"$ref": "#/definitions/v1.SQLStatement"
}
}
},
Expand All @@ -12231,6 +12231,9 @@
"v1.DatabaseDiffModifySQL": {
"type": "object",
"properties": {
"audit_error": {
"type": "string"
},
"modify_sqls": {
"type": "array",
"items": {
Expand Down Expand Up @@ -16088,6 +16091,18 @@
}
}
},
"v1.SQLStatement": {
"type": "object",
"properties": {
"audit_error": {
"type": "string"
},
"sql_statement_with_audit": {
"type": "object",
"$ref": "#/definitions/v1.SQLStatementWithAuditResult"
}
}
},
"v1.SQLStatementWithAuditResult": {
"type": "object",
"properties": {
Expand Down
14 changes: 12 additions & 2 deletions sqle/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -987,10 +987,10 @@ definitions:
v1.DatabaseComparisonStatements:
properties:
base_sql:
$ref: '#/definitions/v1.SQLStatementWithAuditResult'
$ref: '#/definitions/v1.SQLStatement'
type: object
comparison_sql:
$ref: '#/definitions/v1.SQLStatementWithAuditResult'
$ref: '#/definitions/v1.SQLStatement'
type: object
type: object
v1.DatabaseComparisonStatementsResV1:
Expand All @@ -1007,6 +1007,8 @@ definitions:
type: object
v1.DatabaseDiffModifySQL:
properties:
audit_error:
type: string
modify_sqls:
items:
$ref: '#/definitions/v1.SQLStatementWithAuditResult'
Expand Down Expand Up @@ -3644,6 +3646,14 @@ definitions:
query_timeout_second:
type: integer
type: object
v1.SQLStatement:
properties:
audit_error:
type: string
sql_statement_with_audit:
$ref: '#/definitions/v1.SQLStatementWithAuditResult'
type: object
type: object
v1.SQLStatementWithAuditResult:
properties:
audit_results:
Expand Down

0 comments on commit d4930d3

Please sign in to comment.