Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: remove deadcode (#18546)
h3n4l68955d5b5c29
diff --git a/backend/common/testcontainer/testcontainer.go b/backend/common/testcontainer/testcontainer.goindex 70f609304e..c11f5076d9 100644--- a/backend/common/testcontainer/testcontainer.go+++ b/backend/common/testcontainer/testcontainer.go@@ -403,10 +403,6 @@ func (c *MongoDBContainer) GetPassword() string {return c.password}-func (c *MongoDBContainer) GetConnectionURI() string {- return fmt.Sprintf("mongodb://%s:%s@%s:%s/?authSource=admin", c.username, c.password, c.host, c.port)-}-func (c *MongoDBContainer) Close(ctx context.Context) {if c == nil {returndiff --git a/backend/plugin/parser/base/diff.go b/backend/plugin/parser/base/diff.godeleted file mode 100644index 89d6d36b65..0000000000--- a/backend/plugin/parser/base/diff.go+++ /dev/null@@ -1,7 +0,0 @@-package base--// DiffContext is the context for diffing.-type DiffContext struct {- IgnoreCaseSensitive bool- StrictMode bool-}diff --git a/backend/plugin/parser/cockroachdb/ast.go b/backend/plugin/parser/cockroachdb/ast.goindex d64e17e4d1..f304950f8e 100644--- a/backend/plugin/parser/cockroachdb/ast.go+++ b/backend/plugin/parser/cockroachdb/ast.go@@ -5,7 +5,6 @@ import ("github.com/cockroachdb/cockroachdb-parser/pkg/sql/sem/tree"storepb "github.com/bytebase/bytebase/backend/generated-go/store"- "github.com/bytebase/bytebase/backend/plugin/parser/base")// AST is the AST implementation for CockroachDB parser.@@ -20,13 +19,3 @@ type AST struct {func (a *AST) ASTStartPosition() *storepb.Position {return a.StartPosition}--// GetCockroachDBAST extracts the CockroachDB AST from a base.AST.-// Returns the AST and true if it is a CockroachDB AST, nil and false otherwise.-func GetCockroachDBAST(a base.AST) (*AST, bool) {- if a == nil {- return nil, false- }- crAST, ok := a.(*AST)- return crAST, ok-}diff --git a/backend/plugin/parser/mysql/normalize.go b/backend/plugin/parser/mysql/normalize.goindex 89c390624c..3d7b6f2bc5 100644--- a/backend/plugin/parser/mysql/normalize.go+++ b/backend/plugin/parser/mysql/normalize.go@@ -157,16 +157,6 @@ func NormalizeMySQLIdentifierList(ctx parser.IIdentifierListContext) []string {return result}-func NormalizeMySQLViewRef(ctx parser.IViewRefContext) (string, string) {- if ctx.QualifiedIdentifier() != nil {- return normalizeMySQLQualifiedIdentifier(ctx.QualifiedIdentifier())- }- if ctx.DotIdentifier() != nil {- return "", NormalizeMySQLIdentifier(ctx.DotIdentifier().Identifier())- }- return "", ""-}-// NormalizeMySQLViewName normalizes the given view name.func NormalizeMySQLViewName(ctx parser.IViewNameContext) (string, string) {if ctx.QualifiedIdentifier() != nil {@@ -178,14 +168,6 @@ func NormalizeMySQLViewName(ctx parser.IViewNameContext) (string, string) {return "", ""}-// NormalizeMySQLEventName normalizes the given event name.-func NormalizeMySQLEventName(ctx parser.IEventNameContext) (string, string) {- if ctx.QualifiedIdentifier() != nil {- return normalizeMySQLQualifiedIdentifier(ctx.QualifiedIdentifier())- }- return "", ""-}-// NormalizeMySQLTriggerName normalizes the given trigger name.func NormalizeMySQLTriggerName(ctx parser.ITriggerNameContext) (string, string) {if ctx.QualifiedIdentifier() != nil {@@ -202,14 +184,6 @@ func NormalizeMySQLFunctionName(ctx parser.IFunctionNameContext) (string, stringreturn "", ""}-// NormalizeMySQLFunctionRef normalizes the given function ref.-func NormalizeMySQLFunctionRef(ctx parser.IFunctionRefContext) (string, string) {- if ctx.QualifiedIdentifier() != nil {- return normalizeMySQLQualifiedIdentifier(ctx.QualifiedIdentifier())- }- return "", ""-}-// NormalizeMySQLProcedureName normalizes the given procedure name.func NormalizeMySQLProcedureName(ctx parser.IProcedureNameContext) (string, string) {if ctx.QualifiedIdentifier() != nil {@@ -218,14 +192,6 @@ func NormalizeMySQLProcedureName(ctx parser.IProcedureNameContext) (string, strireturn "", ""}-// NormalizeMySQLProcedureRef normalizes the given procedure ref.-func NormalizeMySQLProcedureRef(ctx parser.IProcedureRefContext) (string, string) {- if ctx.QualifiedIdentifier() != nil {- return normalizeMySQLQualifiedIdentifier(ctx.QualifiedIdentifier())- }- return "", ""-}-// NormalizeMySQLSchemaRef normalize the given schemaRef.func NormalizeMySQLSchemaRef(ctx parser.ISchemaRefContext) string {if ctx.Identifier() != nil {diff --git a/backend/plugin/parser/plsql/plsql.go b/backend/plugin/parser/plsql/plsql.goindex 882f9ceb05..e1922732c4 100644--- a/backend/plugin/parser/plsql/plsql.go+++ b/backend/plugin/parser/plsql/plsql.go@@ -228,20 +228,6 @@ func IsOracleKeyword(text string) bool {return oracleKeywords[strings.ToUpper(text)] || oracleReservedWords[strings.ToUpper(text)]}-// NormalizeConstraintName returns the normalized constraint name from the given context.-func NormalizeConstraintName(constraintName parser.IConstraint_nameContext) (string, string) {- if constraintName == nil {- return "", ""- }-- if constraintName.Id_expression(0) != nil {- return NormalizeIdentifierContext(constraintName.Identifier()),- NormalizeIDExpression(constraintName.Id_expression(0))- }-- return "", NormalizeIdentifierContext(constraintName.Identifier())-}-// NormalizeIdentifierContext returns the normalized identifier from the given context.func NormalizeIdentifierContext(identifier parser.IIdentifierContext) string {if identifier == nil {diff --git a/backend/plugin/parser/tidb/tidb.go b/backend/plugin/parser/tidb/tidb.goindex 25159245ce..450ee80a00 100644--- a/backend/plugin/parser/tidb/tidb.go+++ b/backend/plugin/parser/tidb/tidb.go@@ -137,25 +137,6 @@ func ParseTiDB(sql string, charset string, collation string) ([]ast.StmtNode, erreturn nodes, nil}-// IsDelimiter returns true if the statement is a delimiter statement.-func IsDelimiter(stmt string) bool {- delimiterRegex := `(?i)^\s*DELIMITER\s+`- re := regexp.MustCompile(delimiterRegex)- return re.MatchString(stmt)-}--// ExtractDelimiter extracts the delimiter from the delimiter statement.-func ExtractDelimiter(stmt string) (string, error) {- delimiterRegex := `(?i)^\s*DELIMITER\s+(?P<DELIMITER>[^\s\\]+)\s*`- re := regexp.MustCompile(delimiterRegex)- matchList := re.FindStringSubmatch(stmt)- index := re.SubexpIndex("DELIMITER")- if index >= 0 && index < len(matchList) {- return matchList[index], nil- }- return "", errors.Errorf("cannot extract delimiter from %q", stmt)-}-var (lineColumnRegex = regexp.MustCompile(`line (\d+) column (\d+)`))diff --git a/backend/plugin/parser/tokenizer/tokenizer.go b/backend/plugin/parser/tokenizer/tokenizer.goindex 98477a1fbc..434a445157 100644--- a/backend/plugin/parser/tokenizer/tokenizer.go+++ b/backend/plugin/parser/tokenizer/tokenizer.go@@ -19,8 +19,6 @@ const ()var (- beginRuneList = []rune{'B', 'E', 'G', 'I', 'N'}- atomicRuneList = []rune{'A', 'T', 'O', 'M', 'I', 'C'}delimiterRuneList = []rune{'D', 'E', 'L', 'I', 'M', 'I', 'T', 'E', 'R'})@@ -464,132 +462,6 @@ func (t *Tokenizer) SplitStandardMultiSQL() ([]base.Statement, error) {}}-// SplitPostgreSQLMultiSQL splits the statement to a string slice.-// We mainly considered:-//-// comments-// - style /* comments */-// - style -- comments-// string-// - style 'string'-// - style $$ string $$-// identifier-// - style "indentifier"-//-// Notice:-// - We support PostgreSQL CREATE PROCEDURE statement with $$ $$ style,-// but do not support BEGIN ATOMIC ... END; style.-// See https://www.postgresql.org/docs/14/sql-createprocedure.html.-func (t *Tokenizer) SplitPostgreSQLMultiSQL() ([]base.Statement, error) {- var res []base.Statement-- t.skipBlank()- t.emptyStatement = true- startPos := t.cursor- startLine := t.line // Track the starting line number (1-based)- for {- switch {- case t.char(0) == '/' && t.char(1) == '*':- if err := t.scanComment(); err != nil {- return nil, err- }- t.skipBlank()- case t.char(0) == '-' && t.char(1) == '-':- if err := t.scanComment(); err != nil {- return nil, err- }- t.skipBlank()- case t.char(0) == '\'':- if err := t.scanString('\''); err != nil {- return nil, err- }- t.emptyStatement = false- case t.char(0) == '$':- if err := t.scanDoubleDollarQuotedString(); err != nil {- return nil, err- }- t.emptyStatement = false- case t.char(0) == '"':- if err := t.scanIdentifier('"'); err != nil {- return nil, err- }- t.emptyStatement = false- case t.char(0) == ';':- t.skip(1)- text := t.getString(startPos, t.pos()-startPos)- if t.f == nil {- res = append(res, base.Statement{- Text: text,- // BaseLine is 0-based line number, so subtract 1 from 1-based startLine- BaseLine: startLine - 1,- End: &store.Position{Line: int32(t.line)},- Empty: t.emptyStatement,- Range: &store.Range{- Start: int32(t.getByteOffset(int(startPos))),- End: int32(t.getByteOffset(int(t.pos()))),- },- })- }- t.skipBlank()- if err := t.processStreaming(text); err != nil {- return nil, err- }- startPos = t.pos()- startLine = t.line // Update startLine for next statement- t.emptyStatement = true- case t.char(0) == eofRune:- s := t.getString(startPos, t.pos())- if !emptyString(s) {- if t.f == nil {- res = append(res, base.Statement{- Text: s,- // BaseLine is 0-based line number, so subtract 1 from 1-based startLine- BaseLine: startLine - 1,- // Consider this text:- // CREATE TABLE t(- // a int- // )- //- // EOF line- //- // Our current location is the EOF line.- // The line t.line is the line after ')',- // but we want to get the line of last line of the SQL- // which means the line of ')'.- // So we need minus the aboveNonBlankLineDistance.- End: &store.Position{- Line: int32(t.line - t.aboveNonBlankLineDistance()),- },- Empty: t.emptyStatement,- Range: &store.Range{- Start: int32(t.getByteOffset(int(startPos))),- End: int32(t.getByteOffset(int(t.pos()))),- },- })- }- if err := t.processStreaming(s); err != nil {- return nil, err- }- }- return res, t.readErr- // return error when meeting BEGIN ATOMIC.- case t.equalWordCaseInsensitive(beginRuneList):- t.skip(uint(len(beginRuneList)))- t.skipBlank()- if t.equalWordCaseInsensitive(atomicRuneList) {- return nil, errors.Errorf("not support BEGIN ATOMIC ... END in PostgreSQL CREATE PROCEDURE statement, please use double doller style($$ or $tag$) instead of it")- }- t.emptyStatement = false- case t.char(0) == '\n':- t.line++- t.skip(1)- default:- t.skip(1)- t.emptyStatement = false- }- }-}-// Assume that identifier only contains letters, underscores, digits (0-9), or dollar signs ($).// See https://www.postgresql.org/docs/current/sql-syntax-lexical.html.func (t *Tokenizer) scanIdentifier(delimiter rune) error {@@ -640,22 +512,6 @@ func (t *Tokenizer) scanString(delimiter rune) error {}}-// Double dollar quoted string is a PostgreSQL-specific syntax.-// There are two syntax styles, tag and no tag:-// - $$ string $$-// - $tag$ string $tag$-// See https://www.postgresql.org/docs/current/sql-syntax-lexical.html.-func (t *Tokenizer) scanDoubleDollarQuotedString() error {- startPos := t.pos()- // scan the tag string quoted by the dollar sign($)- if err := t.scanString('$'); err != nil {- return err- }- // here tag means $$ or $tag_string$ which means include the dollar sign($).- tag := t.runeList(startPos, t.pos()-startPos)- return t.scanTo(tag)-}-func (t *Tokenizer) scanComment() error {switch {case t.char(0) == '/' && t.char(1) == '*':diff --git a/backend/plugin/parser/trino/split_test.go b/backend/plugin/parser/trino/split_test.goindex 54662800b8..040af12f66 100644--- a/backend/plugin/parser/trino/split_test.go+++ b/backend/plugin/parser/trino/split_test.go@@ -19,12 +19,6 @@ type resData struct {err string}-// MockSplitSQL is a simplified implementation for testing-func MockSplitSQL(_ string) ([]base.Statement, error) {- // This is just for testing and isn't used since the real implementation exists in split.go- return []base.Statement{}, nil-}-func TestTrinoSplitMultiSQL(t *testing.T) {// Split SQL functionality is implementedtests := []splitTestData{diff --git a/backend/plugin/schema/mysql/get_database_definition.go b/backend/plugin/schema/mysql/get_database_definition.goindex 3070e3e0a8..6a8ccc5b20 100644--- a/backend/plugin/schema/mysql/get_database_definition.go+++ b/backend/plugin/schema/mysql/get_database_definition.go@@ -45,7 +45,6 @@ const (mysqlNoAction = "NO ACTION"autoIncrementSymbol = "AUTO_INCREMENT"- autoRandSymbol = "AUTO_RANDOM")func init() {diff --git a/backend/plugin/schema/pg/ast/expression_ast.go b/backend/plugin/schema/pg/ast/expression_ast.goindex 10157e3625..9c2696be79 100644--- a/backend/plugin/schema/pg/ast/expression_ast.go+++ b/backend/plugin/schema/pg/ast/expression_ast.go@@ -2,7 +2,6 @@ package astimport ("fmt"- "slices""strings")@@ -389,21 +388,3 @@ func isCommutativeOperator(op string) bool {}return commutativeOps[strings.ToUpper(op)]}--// SortExpressions sorts expression list for unordered comparison-func SortExpressions(exprs []ExpressionAST) []ExpressionAST {- sorted := make([]ExpressionAST, len(exprs))- copy(sorted, exprs)-- slices.SortFunc(sorted, func(a, b ExpressionAST) int {- if a.String() < b.String() {- return -1- }- if a.String() > b.String() {- return 1- }- return 0- })-- return sorted-}diff --git a/backend/plugin/schema/pg/ast/expression_comparer.go b/backend/plugin/schema/pg/ast/expression_comparer.goindex eb316c8ef9..be2f330da8 100644--- a/backend/plugin/schema/pg/ast/expression_comparer.go+++ b/backend/plugin/schema/pg/ast/expression_comparer.go@@ -654,8 +654,3 @@ func (*PostgreSQLExpressionComparer) normalizeCasePreservingStringLiterals(exprreturn strings.Join(singleQuoteParts, "'")}--// CreatePostgreSQLExpressionComparer creates a PostgreSQL expression comparer with default settings-func CreatePostgreSQLExpressionComparer() ExpressionComparer {- return NewPostgreSQLExpressionComparer()-}diff --git a/backend/plugin/schema/pg/ast/expression_normalizer.go b/backend/plugin/schema/pg/ast/expression_normalizer.goindex 18c7d562a4..d1ca9c8fb8 100644--- a/backend/plugin/schema/pg/ast/expression_normalizer.go+++ b/backend/plugin/schema/pg/ast/expression_normalizer.go@@ -1,7 +1,6 @@package astimport (- "slices""strings")@@ -358,56 +357,6 @@ func (*normalizationVisitor) isQuotedIdentifier(identifier string) bool {(identifier[0] == '`' && identifier[len(identifier)-1] == '`'))}-// ExpressionListNormalizer provides utilities for normalizing lists of expressions-type ExpressionListNormalizer struct {- normalizer *ExpressionNormalizer-}--// NewExpressionListNormalizer creates a new expression list normalizer-func NewExpressionListNormalizer() *ExpressionListNormalizer {- return &ExpressionListNormalizer{- normalizer: NewExpressionNormalizer(),- }-}--// NormalizeExpressionList normalizes a list of expression strings-func (ln *ExpressionListNormalizer) NormalizeExpressionList(expressions []string) ([]string, error) {- var normalized []string-- for _, expr := range expressions {- normalizedExpr, err := ln.normalizer.NormalizeExpressionString(expr)- if err != nil {- return nil, err- }- normalized = append(normalized, normalizedExpr)- }-- return normalized, nil-}--// NormalizeAndSortExpressionList normalizes and sorts a list of expressions for unordered comparison-func (ln *ExpressionListNormalizer) NormalizeAndSortExpressionList(expressions []string) ([]string, error) {- normalized, err := ln.NormalizeExpressionList(expressions)- if err != nil {- return nil, err- }-- // Sort the normalized expressions- // This is useful for comparing lists where order doesn't matter- return SortStringList(normalized), nil-}--// SortStringList sorts a list of strings-func SortStringList(strs []string) []string {- sorted := make([]string, len(strs))- copy(sorted, strs)-- // Use Go's slices.Sort function (more efficient than sort.Strings)- slices.Sort(sorted)-- return sorted-}-// isRedundantTypeCast checks if a type cast can be safely removed// This handles cases where PostgreSQL implicit casting makes explicit casts unnecessaryfunc (v *normalizationVisitor) isRedundantTypeCast(leftExpr, typeExpr ExpressionAST) bool {diff --git a/backend/plugin/schema/pg/ast/expression_visitor.go b/backend/plugin/schema/pg/ast/expression_visitor.goindex 13589b5d85..3b27f93c83 100644--- a/backend/plugin/schema/pg/ast/expression_visitor.go+++ b/backend/plugin/schema/pg/ast/expression_visitor.go@@ -43,200 +43,6 @@ func (*BaseExpressionVisitor) VisitParentheses(expr *ParenthesesExpr) any {return expr}-// StringBuilderVisitor builds a string representation of expressions-type StringBuilderVisitor struct {- BaseExpressionVisitor- builder strings.Builder-}--// NewStringBuilderVisitor creates a new string builder visitor-func NewStringBuilderVisitor() *StringBuilderVisitor {- return &StringBuilderVisitor{}-}--// Build builds the string representation of an expression-func (v *StringBuilderVisitor) Build(expr ExpressionAST) string {- v.builder.Reset()- expr.Accept(v)- return v.builder.String()-}--// VisitIdentifier visits identifier expressions-func (v *StringBuilderVisitor) VisitIdentifier(expr *IdentifierExpr) any {- var parts []string- if expr.Schema != "" && expr.Schema != "public" {- parts = append(parts, expr.Schema)- }- if expr.Table != "" {- parts = append(parts, expr.Table)- }- parts = append(parts, expr.Name)- v.builder.WriteString(strings.Join(parts, "."))- return nil-}--// VisitLiteral visits literal expressions-func (v *StringBuilderVisitor) VisitLiteral(expr *LiteralExpr) any {- v.builder.WriteString(expr.Value)- return nil-}--// VisitBinaryOp visits binary operation expressions-func (v *StringBuilderVisitor) VisitBinaryOp(expr *BinaryOpExpr) any {- expr.Left.Accept(v)- v.builder.WriteString(" ")- v.builder.WriteString(expr.Operator)- v.builder.WriteString(" ")- expr.Right.Accept(v)- return nil-}--// VisitUnaryOp visits unary operation expressions-func (v *StringBuilderVisitor) VisitUnaryOp(expr *UnaryOpExpr) any {- v.builder.WriteString(expr.Operator)- v.builder.WriteString(" ")- expr.Operand.Accept(v)- return nil-}--// VisitFunction visits function expressions-func (v *StringBuilderVisitor) VisitFunction(expr *FunctionExpr) any {- if expr.Schema != "" && expr.Schema != "public" {- v.builder.WriteString(expr.Schema)- v.builder.WriteString(".")- }- v.builder.WriteString(expr.Name)- v.builder.WriteString("(")-- for i, arg := range expr.Args {- if i > 0 {- v.builder.WriteString(", ")- }- arg.Accept(v)- }-- v.builder.WriteString(")")- return nil-}--// VisitList visits list expressions-func (v *StringBuilderVisitor) VisitList(expr *ListExpr) any {- v.builder.WriteString("(")- for i, elem := range expr.Elements {- if i > 0 {- v.builder.WriteString(", ")- }- elem.Accept(v)- }- v.builder.WriteString(")")- return nil-}--// VisitParentheses visits parentheses expressions-func (v *StringBuilderVisitor) VisitParentheses(expr *ParenthesesExpr) any {- v.builder.WriteString("(")- expr.Inner.Accept(v)- v.builder.WriteString(")")- return nil-}--// ExpressionTypeVisitor extracts expression types from AST-type ExpressionTypeVisitor struct {- BaseExpressionVisitor- types []ExpressionType-}--// NewExpressionTypeVisitor creates a new expression type visitor-func NewExpressionTypeVisitor() *ExpressionTypeVisitor {- return &ExpressionTypeVisitor{}-}--// GetTypes returns all expression types found in the AST-func (v *ExpressionTypeVisitor) GetTypes(expr ExpressionAST) []ExpressionType {- v.types = nil- v.visitRecursively(expr)- return v.types-}--// visitRecursively visits expression and all its children-func (v *ExpressionTypeVisitor) visitRecursively(expr ExpressionAST) {- if expr == nil {- return- }-- v.types = append(v.types, expr.Type())-- for _, child := range expr.Children() {- v.visitRecursively(child)- }-}--// IdentifierCollectorVisitor collects all identifiers from expressions-type IdentifierCollectorVisitor struct {- BaseExpressionVisitor- identifiers []*IdentifierExpr-}--// NewIdentifierCollectorVisitor creates a new identifier collector visitor-func NewIdentifierCollectorVisitor() *IdentifierCollectorVisitor {- return &IdentifierCollectorVisitor{}-}--// GetIdentifiers returns all identifiers found in the expression-func (v *IdentifierCollectorVisitor) GetIdentifiers(expr ExpressionAST) []*IdentifierExpr {- v.identifiers = nil- v.visitRecursively(expr)- return v.identifiers-}--// visitRecursively visits expression and collects identifiers-func (v *IdentifierCollectorVisitor) visitRecursively(expr ExpressionAST) {- if expr == nil {- return- }-- if identifier, ok := expr.(*IdentifierExpr); ok {- v.identifiers = append(v.identifiers, identifier)- }-- for _, child := range expr.Children() {- v.visitRecursively(child)- }-}--// FunctionCollectorVisitor collects all function calls from expressions-type FunctionCollectorVisitor struct {- BaseExpressionVisitor- functions []*FunctionExpr-}--// NewFunctionCollectorVisitor creates a new function collector visitor-func NewFunctionCollectorVisitor() *FunctionCollectorVisitor {- return &FunctionCollectorVisitor{}-}--// GetFunctions returns all function calls found in the expression-func (v *FunctionCollectorVisitor) GetFunctions(expr ExpressionAST) []*FunctionExpr {- v.functions = nil- v.visitRecursively(expr)- return v.functions-}--// visitRecursively visits expression and collects function calls-func (v *FunctionCollectorVisitor) visitRecursively(expr ExpressionAST) {- if expr == nil {- return- }-- if function, ok := expr.(*FunctionExpr); ok {- v.functions = append(v.functions, function)- }-- for _, child := range expr.Children() {- v.visitRecursively(child)- }-}-// ExpressionValidatorVisitor validates expressions for correctnesstype ExpressionValidatorVisitor struct {BaseExpressionVisitordiff --git a/backend/plugin/schema/redshift/get_database_definition.go b/backend/plugin/schema/redshift/get_database_definition.goindex 214870b6c9..fd027a3ef1 100644--- a/backend/plugin/schema/redshift/get_database_definition.go+++ b/backend/plugin/schema/redshift/get_database_definition.go@@ -31,51 +31,6 @@ func GetDatabaseDefinition(_ schema.GetDefinitionContext, to *storepb.DatabaseScreturn s, nil}-func GetTableDefinition(_ string, table *storepb.TableMetadata, _ []*storepb.SequenceMetadata) (string, error) {- var buf strings.Builder- tableState := convertToTableState(0, table)-- if _, err := buf.WriteString(getTableAnnouncement(table.Name)); err != nil {- return "", err- }- if err := tableState.toString(&buf); err != nil {- return "", err- }- // Generate comment for table and columns.- if tableState.comment != "" {- if _, err := buf.WriteString(fmt.Sprintf("COMMENT ON TABLE %s IS '%s';\n", tableState.name, tableState.comment)); err != nil {- return "", err- }- }- for _, column := range tableState.columns {- if column.comment != "" {- if _, err := buf.WriteString(fmt.Sprintf("COMMENT ON COLUMN %s.%s IS '%s';\n", tableState.name, column.name, column.comment)); err != nil {- return "", err- }- }- }- return buf.String(), nil-}--func GetViewDefinition(_ string, view *storepb.ViewMetadata) (string, error) {- var buf strings.Builder- viewState := convertToViewState(0, view)-- if _, err := buf.WriteString(getViewAnnouncement(view.Name)); err != nil {- return "", err- }- if err := viewState.toString(&buf); err != nil {- return "", err- }- // Generate comment for view.- if viewState.comment != "" {- if _, err := buf.WriteString(fmt.Sprintf("COMMENT ON VIEW %s IS '%s';\n", viewState.name, viewState.comment)); err != nil {- return "", err- }- }- return buf.String(), nil-}-func writeTables(w io.StringWriter, to *storepb.DatabaseSchemaMetadata, state *databaseState) error {// Follow the order of the input schemas.for _, schema := range to.Schemas {diff --git a/backend/plugin/webhook/teams/teams.go b/backend/plugin/webhook/teams/teams.goindex f166033abd..403755865c 100644--- a/backend/plugin/webhook/teams/teams.go+++ b/backend/plugin/webhook/teams/teams.go@@ -16,7 +16,6 @@ import ("io""log/slog""net/http"- "strings""github.com/pkg/errors""go.uber.org/multierr"@@ -279,20 +278,3 @@ func getAdaptiveCard(context webhook.Context) *AdaptiveCard {Actions: actions,}}--// GetMarkdownText returns the markdown text for the webhook context.-func GetMarkdownText(context webhook.Context) string {- var markdownBuf strings.Builder-- if context.Description != "" {- _, _ = markdownBuf.WriteString(fmt.Sprintf("%s\n\n", context.Description))- }-- for _, meta := range context.GetMetaList() {- _, _ = markdownBuf.WriteString(fmt.Sprintf("**%s**: %s\n", meta.Name, meta.Value))- }-- _, _ = markdownBuf.WriteString(fmt.Sprintf("\n**Actor**: %s (%s)\n\n[View in Bytebase](%s)", context.ActorName, context.ActorEmail, context.Link))-- return markdownBuf.String()-}diff --git a/backend/store/audit_log.go b/backend/store/audit_log.goindex bff82ca87d..5585a24296 100644--- a/backend/store/audit_log.go+++ b/backend/store/audit_log.go@@ -17,15 +17,6 @@ import (storepb "github.com/bytebase/bytebase/backend/generated-go/store")-type AuditLogMethod string--// The methods other than v1 api.-const AuditLogMethodProjectRepositoryPush AuditLogMethod = "bb.project.repository.push"--func (m AuditLogMethod) String() string {- return string(m)-}-type AuditLog struct {ID intCreatedAt time.Timediff --git a/backend/store/model/version.go b/backend/store/model/version.goindex 4a9f97aa0d..025339f0bc 100644--- a/backend/store/model/version.go+++ b/backend/store/model/version.go@@ -43,14 +43,3 @@ func (v *Version) LessThan(other *Version) bool {func (v *Version) LessThanOrEqual(other *Version) bool {return !other.LessThan(v)}--func (v *Version) String() string {- var b strings.Builder- for i, p := range v.parts {- if i != 0 {- b.WriteString(".")- }- b.WriteString(strconv.FormatUint(p, 10))- }- return b.String()-}