Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: enable ci test (#8904)

zll600d921c1df084a
diff --git a/backend/plugin/advisor/mysqlwip/advisor_charset_allowlist.go b/backend/plugin/advisor/mysqlwip/advisor_charset_allowlist.go
index b066335174..bedab8bdc0 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_charset_allowlist.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_charset_allowlist.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*charsetAllowlistChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLCharsetAllowlist, &CharsetAllowlistAdvisor{})
-}
-
// CharsetAllowlistAdvisor is the advisor checking for charset allowlist.
type CharsetAllowlistAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_collation_allowlist.go b/backend/plugin/advisor/mysqlwip/advisor_collation_allowlist.go
index 4bdb5fe774..15ab8a8774 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_collation_allowlist.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_collation_allowlist.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*collationAllowlistChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLCollationAllowlist, &CollationAllowlistAdvisor{})
-}
-
// CollationAllowlistAdvisor is the advisor checking for collation allowlist.
type CollationAllowlistAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_colum_require_default.go b/backend/plugin/advisor/mysqlwip/advisor_colum_require_default.go
index d131c93f1b..b0090ac489 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_colum_require_default.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_colum_require_default.go
@@ -11,7 +11,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -19,10 +18,6 @@ var (
_ ast.Visitor = (*columRequireDefaultChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLRequireColumnDefault, &ColumRequireDefaultAdvisor{})
-}
-
// ColumRequireDefaultAdvisor is the advisor checking for column default requirement.
type ColumRequireDefaultAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_initial_value.go b/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_initial_value.go
index 66d5171787..70e900e75a 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_initial_value.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_initial_value.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*columnAutoIncrementInitialValueChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLAutoIncrementColumnInitialValue, &ColumnAutoIncrementInitialValueAdvisor{})
-}
-
// ColumnAutoIncrementInitialValueAdvisor is the advisor checking for auto-increment column initial value.
type ColumnAutoIncrementInitialValueAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_integer.go b/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_integer.go
index 457fef220f..eb27f3284a 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_integer.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_integer.go
@@ -11,7 +11,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -19,10 +18,6 @@ var (
_ ast.Visitor = (*columnAutoIncrementMustIntegerChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLAutoIncrementColumnMustInteger, &ColumnAutoIncrementMustIntegerAdvisor{})
-}
-
// ColumnAutoIncrementMustIntegerAdvisor is the advisor checking for auto-increment column type.
type ColumnAutoIncrementMustIntegerAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_unsigned.go b/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_unsigned.go
index 8da6668067..a1593331b4 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_unsigned.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_auto_increment_must_unsigned.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*columnAutoIncrementMustUnsignedChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLAutoIncrementColumnMustUnsigned, &ColumnAutoIncrementMustUnsignedAdvisor{})
-}
-
// ColumnAutoIncrementMustUnsignedAdvisor is the advisor checking for unsigned auto-increment column.
type ColumnAutoIncrementMustUnsignedAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_comment_convention.go b/backend/plugin/advisor/mysqlwip/advisor_column_comment_convention.go
index 1ba3b923ae..d645006c71 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_comment_convention.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_comment_convention.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*columnCommentConventionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnCommentConvention, &ColumnCommentConventionAdvisor{})
-}
-
// ColumnCommentConventionAdvisor is the advisor checking for column comment convention.
type ColumnCommentConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_current_time_count_limit.go b/backend/plugin/advisor/mysqlwip/advisor_column_current_time_count_limit.go
index 6557751cee..b5acaa6a77 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_current_time_count_limit.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_current_time_count_limit.go
@@ -12,7 +12,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
const (
@@ -25,10 +24,6 @@ var (
_ ast.Visitor = (*columnCurrentTimeCountLimitChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLCurrentTimeColumnCountLimit, &ColumnCurrentTimeCountLimitAdvisor{})
-}
-
// ColumnCurrentTimeCountLimitAdvisor is the advisor checking for current time column count limit.
type ColumnCurrentTimeCountLimitAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing.go b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing.go
index 14e19b5877..b23b218c38 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*columnDisallowChangingChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnDisallowChanging, &ColumnDisallowChangingAdvisor{})
-}
-
// ColumnDisallowChangingAdvisor is the advisor checking for disallow CHANGE COLUMN statement.
type ColumnDisallowChangingAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_order.go b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_order.go
index 278e8c3bac..5aa78a99d6 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_order.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_order.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*columnDisallowChangingOrderChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnDisallowChangingOrder, &ColumnDisallowChangingOrderAdvisor{})
-}
-
// ColumnDisallowChangingOrderAdvisor is the advisor checking for disallow changing column order.
type ColumnDisallowChangingOrderAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_type.go b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_type.go
index d308ea9efb..02744a316d 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_type.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_changing_type.go
@@ -11,7 +11,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -19,10 +18,6 @@ var (
_ ast.Visitor = (*columnDisallowChangingTypeChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnDisallowChangingType, &ColumnDisallowChangingTypeAdvisor{})
-}
-
// ColumnDisallowChangingTypeAdvisor is the advisor checking for disallow changing column type..
type ColumnDisallowChangingTypeAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_drop_in_index.go b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_drop_in_index.go
index 72afddcf66..7ff2d0ce36 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_drop_in_index.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_drop_in_index.go
@@ -10,7 +10,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*columnDisallowDropInIndexChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnDisallowDropInIndex, &ColumnDisallowDropInIndexAdvisor{})
-}
-
// ColumnDisallowDropInIndexAdvisor is the advisor checking for disallow DROP COLUMN in index.
type ColumnDisallowDropInIndexAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_set_charset.go b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_set_charset.go
index 048e2025d2..3f90b4e532 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_disallow_set_charset.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_disallow_set_charset.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*columnDisallowSetCharsetChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLDisallowSetColumnCharset, &ColumnDisallowSetCharsetAdvisor{})
-}
-
// ColumnDisallowSetCharsetAdvisor is the advisor checking for disallow set column charset.
type ColumnDisallowSetCharsetAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_maximum_character_length.go b/backend/plugin/advisor/mysqlwip/advisor_column_maximum_character_length.go
index bc93f91d37..d85262228e 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_maximum_character_length.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_maximum_character_length.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*columnMaximumCharacterLengthChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnMaximumCharacterLength, &ColumnMaximumCharacterLengthAdvisor{})
-}
-
// ColumnMaximumCharacterLengthAdvisor is the advisor checking for max character length.
type ColumnMaximumCharacterLengthAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_no_null.go b/backend/plugin/advisor/mysqlwip/advisor_column_no_null.go
index b87aade667..4bf64be2f9 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_no_null.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_no_null.go
@@ -9,7 +9,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*columnNoNullChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnNoNull, &ColumnNoNullAdvisor{})
-}
-
// ColumnNoNullAdvisor is the advisor checking for column no NULL value.
type ColumnNoNullAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_required.go b/backend/plugin/advisor/mysqlwip/advisor_column_required.go
index aedd05c771..4594050b38 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_required.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_required.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*columnRequirementChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnRequirement, &ColumnRequirementAdvisor{})
-}
-
// ColumnRequirementAdvisor is the advisor checking for column requirement.
type ColumnRequirementAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_set_default_for_not_null.go b/backend/plugin/advisor/mysqlwip/advisor_column_set_default_for_not_null.go
index 79fb776c0a..4e56c00806 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_set_default_for_not_null.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_set_default_for_not_null.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*columnSetDefaultForNotNullChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnSetDefaultForNotNull, &ColumnSetDefaultForNotNullAdvisor{})
-}
-
// ColumnSetDefaultForNotNullAdvisor is the advisor checking for set default value for not null column.
type ColumnSetDefaultForNotNullAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_column_type_restriction.go b/backend/plugin/advisor/mysqlwip/advisor_column_type_restriction.go
index b10bc87075..8f058bcbd2 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_column_type_restriction.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_column_type_restriction.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*columnTypeRestrictionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLColumnTypeRestriction, &ColumnTypeRestrictionAdvisor{})
-}
-
// ColumnTypeRestrictionAdvisor is the advisor checking for column type restriction.
type ColumnTypeRestrictionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_database_drop_empty_db.go b/backend/plugin/advisor/mysqlwip/advisor_database_drop_empty_db.go
index 85373db442..b897757ba2 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_database_drop_empty_db.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_database_drop_empty_db.go
@@ -8,7 +8,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -16,10 +15,6 @@ var (
_ ast.Visitor = (*allowDropEmptyDBChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLDatabaseAllowDropIfEmpty, &DatabaseAllowDropIfEmptyAdvisor{})
-}
-
// DatabaseAllowDropIfEmptyAdvisor is the advisor checking the MySQLDatabaseAllowDropIfEmpty rule.
type DatabaseAllowDropIfEmptyAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_index_key_number_limit.go b/backend/plugin/advisor/mysqlwip/advisor_index_key_number_limit.go
index 76f5413e5f..3110305eaa 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_index_key_number_limit.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_index_key_number_limit.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*indexKeyNumberLimitChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLIndexKeyNumberLimit, &IndexKeyNumberLimitAdvisor{})
-}
-
// IndexKeyNumberLimitAdvisor is the advisor checking for index key number limit.
type IndexKeyNumberLimitAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_index_no_duplicate_column.go b/backend/plugin/advisor/mysqlwip/advisor_index_no_duplicate_column.go
index fb8fbb501a..3a761b9339 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_index_no_duplicate_column.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_index_no_duplicate_column.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*indexNoDuplicateColumnChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLIndexNoDuplicateColumn, &IndexNoDuplicateColumnAdvisor{})
-}
-
// IndexNoDuplicateColumnAdvisor is the advisor checking for no duplicate columns in index.
type IndexNoDuplicateColumnAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.go b/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.go
index adac587cc9..f725ccd878 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.go
@@ -12,7 +12,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -20,10 +19,6 @@ var (
_ ast.Visitor = (*indexPkTypeChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLIndexPKType, &IndexPkTypeAdvisor{})
-}
-
// IndexPkTypeAdvisor is the advisor checking for correct type of PK.
type IndexPkTypeAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_index_primary_key_type_allowlist.go b/backend/plugin/advisor/mysqlwip/advisor_index_primary_key_type_allowlist.go
index f30da82931..38adbfcb4b 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_index_primary_key_type_allowlist.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_index_primary_key_type_allowlist.go
@@ -12,7 +12,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
tidbparser "github.com/bytebase/bytebase/backend/plugin/parser/tidb"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -20,10 +19,6 @@ var (
_ ast.Visitor = (*indexPrimaryKeyTypeAllowlistChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLPrimaryKeyTypeAllowlist, &IndexPrimaryKeyTypeAllowlistAdvisor{})
-}
-
// IndexPrimaryKeyTypeAllowlistAdvisor is the advisor checking for primary key type allowlist.
type IndexPrimaryKeyTypeAllowlistAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_index_total_number_limit.go b/backend/plugin/advisor/mysqlwip/advisor_index_total_number_limit.go
index e46e847c2b..71f8c390be 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_index_total_number_limit.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_index_total_number_limit.go
@@ -11,7 +11,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -19,10 +18,6 @@ var (
_ ast.Visitor = (*indexTotalNumberLimitChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLIndexTotalNumberLimit, &IndexTotalNumberLimitAdvisor{})
-}
-
// IndexTotalNumberLimitAdvisor is the advisor checking for index total number limit.
type IndexTotalNumberLimitAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.go b/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.go
index 98aa4294e6..6716bdc93d 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.go
@@ -13,7 +13,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -21,10 +20,6 @@ var (
_ ast.Visitor = (*indexTypeNoBlobChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLIndexTypeNoBlob, &IndexTypeNoBlobAdvisor{})
-}
-
// IndexTypeNoBlobAdvisor is the advisor checking for index type no blob.
type IndexTypeNoBlobAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_insert_disallow_order_by_rand.go b/backend/plugin/advisor/mysqlwip/advisor_insert_disallow_order_by_rand.go
index 2f70c82b5d..6d7cf2a450 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_insert_disallow_order_by_rand.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_insert_disallow_order_by_rand.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*insertDisallowOrderByRandChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLInsertDisallowOrderByRand, &InsertDisallowOrderByRandAdvisor{})
-}
-
// InsertDisallowOrderByRandAdvisor is the advisor checking for to disallow order by rand in INSERT statements.
type InsertDisallowOrderByRandAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_insert_must_specify_column.go b/backend/plugin/advisor/mysqlwip/advisor_insert_must_specify_column.go
index d99e110f5f..ab2abeb694 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_insert_must_specify_column.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_insert_must_specify_column.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*insertMustSpecifyColumnChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLInsertMustSpecifyColumn, &InsertMustSpecifyColumnAdvisor{})
-}
-
// InsertMustSpecifyColumnAdvisor is the advisor checking for to enforce column specified.
type InsertMustSpecifyColumnAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_migration_compatibility.go b/backend/plugin/advisor/mysqlwip/advisor_migration_compatibility.go
index 25b401d275..eeca624119 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_migration_compatibility.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_migration_compatibility.go
@@ -6,7 +6,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
"github.com/pingcap/tidb/parser/ast"
)
@@ -16,10 +15,6 @@ var (
_ ast.Visitor = (*compatibilityChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLMigrationCompatibility, &CompatibilityAdvisor{})
-}
-
// CompatibilityAdvisor is the advisor checking for schema backward compatibility.
type CompatibilityAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_naming_auto_increment_column.go b/backend/plugin/advisor/mysqlwip/advisor_naming_auto_increment_column.go
index 05e2b955c1..a6c884dc74 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_naming_auto_increment_column.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_naming_auto_increment_column.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*namingAutoIncrementColumnChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLNamingAutoIncrementColumnConvention, &NamingAutoIncrementColumnAdvisor{})
-}
-
// NamingAutoIncrementColumnAdvisor is the advisor checking for auto-increment naming convention.
type NamingAutoIncrementColumnAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_naming_column.go b/backend/plugin/advisor/mysqlwip/advisor_naming_column.go
index ad561bd0b1..8c31a7c71b 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_naming_column.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_naming_column.go
@@ -8,7 +8,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -16,10 +15,6 @@ var (
_ ast.Visitor = (*namingColumnConventionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLNamingColumnConvention, &NamingColumnConventionAdvisor{})
-}
-
// NamingColumnConventionAdvisor is the advisor checking for column naming convention.
type NamingColumnConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_naming_foreign_key_convention.go b/backend/plugin/advisor/mysqlwip/advisor_naming_foreign_key_convention.go
index f82bfc2164..238f3fa7a2 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_naming_foreign_key_convention.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_naming_foreign_key_convention.go
@@ -8,7 +8,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -16,10 +15,6 @@ var (
_ ast.Visitor = (*namingFKConventionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLNamingFKConvention, &NamingFKConventionAdvisor{})
-}
-
// NamingFKConventionAdvisor is the advisor checking for foreign key naming convention.
type NamingFKConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_naming_index_convention.go b/backend/plugin/advisor/mysqlwip/advisor_naming_index_convention.go
index cb854de778..fcde3c960c 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_naming_index_convention.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_naming_index_convention.go
@@ -10,7 +10,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*namingIndexConventionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLNamingIndexConvention, &NamingIndexConventionAdvisor{})
-}
-
// NamingIndexConventionAdvisor is the advisor checking for index naming convention.
type NamingIndexConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_naming_table.go b/backend/plugin/advisor/mysqlwip/advisor_naming_table.go
index 8e7f96996c..569d99a464 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_naming_table.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_naming_table.go
@@ -10,12 +10,18 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
mysqlparser "github.com/bytebase/bytebase/backend/plugin/parser/mysql"
+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
_ advisor.Advisor = (*NamingTableConventionAdvisor)(nil)
)
+func init() {
+ // only for test mysqlwip.
+ advisor.Register(storepb.Engine_ENGINE_UNSPECIFIED, advisor.MySQLNamingTableConvention, &NamingTableConventionAdvisor{})
+}
+
// NamingTableConventionAdvisor is the advisor checking for table naming convention.
type NamingTableConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go b/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go
index a8618b1ccc..933261ff09 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go
@@ -9,7 +9,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*namingUKConventionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLNamingUKConvention, &NamingUKConventionAdvisor{})
-}
-
// NamingUKConventionAdvisor is the advisor checking for unique key naming convention.
type NamingUKConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_statement_dml_dry_run.go b/backend/plugin/advisor/mysqlwip/advisor_statement_dml_dry_run.go
index 353c54c386..4996c5da2f 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_statement_dml_dry_run.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_statement_dml_dry_run.go
@@ -11,7 +11,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -19,10 +18,6 @@ var (
_ ast.Visitor = (*statementDmlDryRunChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLStatementDMLDryRun, &StatementDmlDryRunAdvisor{})
-}
-
// StatementDmlDryRunAdvisor is the advisor checking for DML dry run.
type StatementDmlDryRunAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_statement_merge_alter_table.go b/backend/plugin/advisor/mysqlwip/advisor_statement_merge_alter_table.go
index e81fd5a943..9ddfbab32c 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_statement_merge_alter_table.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_statement_merge_alter_table.go
@@ -10,7 +10,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -18,10 +17,6 @@ var (
_ ast.Visitor = (*statementMergeAlterTableChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLMergeAlterTable, &StatementMergeAlterTableAdvisor{})
-}
-
// StatementMergeAlterTableAdvisor is the advisor checking for merging ALTER TABLE statements.
type StatementMergeAlterTableAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_commit.go b/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_commit.go
index 71c27998e0..2dc57d3fbc 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_commit.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_commit.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*statementDisallowCommitChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLStatementDisallowCommit, &StatementDisallowCommitAdvisor{})
-}
-
// StatementDisallowCommitAdvisor is the advisor checking for index type no blob.
type StatementDisallowCommitAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_limit.go b/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_limit.go
index 4f45f8680b..bec2969575 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_limit.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_limit.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*disallowLimitChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLDisallowLimit, &DisallowLimitAdvisor{})
-}
-
// DisallowLimitAdvisor is the advisor checking for no LIMIT clause in INSERT/UPDATE statement.
type DisallowLimitAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_order_by.go b/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_order_by.go
index ae7f2d92a5..fff8a077ac 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_order_by.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_stmt_disallow_order_by.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*disallowOrderByChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLDisallowOrderBy, &DisallowOrderByAdvisor{})
-}
-
// DisallowOrderByAdvisor is the advisor checking for no ORDER BY clause in DELETE/UPDATE statements.
type DisallowOrderByAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_stmt_no_leading_wildcard_like.go b/backend/plugin/advisor/mysqlwip/advisor_stmt_no_leading_wildcard_like.go
index 981d0a7b40..885b135fca 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_stmt_no_leading_wildcard_like.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_stmt_no_leading_wildcard_like.go
@@ -8,7 +8,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
const (
@@ -20,10 +19,6 @@ var (
_ ast.Visitor = (*noLeadingWildcardLikeChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLNoLeadingWildcardLike, &NoLeadingWildcardLikeAdvisor{})
-}
-
// NoLeadingWildcardLikeAdvisor is the advisor checking for no leading wildcard LIKE.
type NoLeadingWildcardLikeAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go b/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go
index 9dffcdbf18..5a315eee89 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go
@@ -7,7 +7,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -15,10 +14,6 @@ var (
_ ast.Visitor = (*noSelectAllChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLNoSelectAll, &NoSelectAllAdvisor{})
-}
-
// NoSelectAllAdvisor is the advisor checking for no "select *".
type NoSelectAllAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_stmt_where_required.go b/backend/plugin/advisor/mysqlwip/advisor_stmt_where_required.go
index 7a11a872f0..567edafada 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_stmt_where_required.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_stmt_where_required.go
@@ -6,7 +6,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
"github.com/pingcap/tidb/parser/ast"
)
@@ -16,10 +15,6 @@ var (
_ ast.Visitor = (*whereRequirementChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLWhereRequirement, &WhereRequirementAdvisor{})
-}
-
// WhereRequirementAdvisor is the advisor checking for the WHERE clause requirement.
type WhereRequirementAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_table_comment_convention.go b/backend/plugin/advisor/mysqlwip/advisor_table_comment_convention.go
index a6c529b9b6..048f9a6a4b 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_table_comment_convention.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_table_comment_convention.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*tableCommentConventionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLTableCommentConvention, &TableCommentConventionAdvisor{})
-}
-
// TableCommentConventionAdvisor is the advisor checking for table comment convention.
type TableCommentConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_table_disallow_partition.go b/backend/plugin/advisor/mysqlwip/advisor_table_disallow_partition.go
index 943b699f7d..7924a0c6c9 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_table_disallow_partition.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_table_disallow_partition.go
@@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -17,10 +16,6 @@ var (
_ ast.Visitor = (*tableDisallowPartitionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLTableDisallowPartition, &TableDisallowPartitionAdvisor{})
-}
-
// TableDisallowPartitionAdvisor is the advisor checking for disallow table partition.
type TableDisallowPartitionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_table_drop_naming_convention.go b/backend/plugin/advisor/mysqlwip/advisor_table_drop_naming_convention.go
index d2022181e5..7800daada7 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_table_drop_naming_convention.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_table_drop_naming_convention.go
@@ -8,7 +8,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -16,10 +15,6 @@ var (
_ ast.Visitor = (*namingDropTableConventionChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLTableDropNamingConvention, &TableDropNamingConventionAdvisor{})
-}
-
// TableDropNamingConventionAdvisor is the advisor checking the MySQLTableDropNamingConvention rule.
type TableDropNamingConventionAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_table_no_fk.go b/backend/plugin/advisor/mysqlwip/advisor_table_no_fk.go
index 58df746934..d98acd6821 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_table_no_fk.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_table_no_fk.go
@@ -7,7 +7,6 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
var (
@@ -15,10 +14,6 @@ var (
_ ast.Visitor = (*tableNoFKChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLTableNoFK, &TableNoFKAdvisor{})
-}
-
// TableNoFKAdvisor is the advisor checking table disallow foreign key.
type TableNoFKAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/advisor_table_require_pk.go b/backend/plugin/advisor/mysqlwip/advisor_table_require_pk.go
index fb3f4aa376..589aa7beb0 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_table_require_pk.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_table_require_pk.go
@@ -9,7 +9,6 @@ import (
"github.com/bytebase/bytebase/backend/plugin/advisor"
"github.com/bytebase/bytebase/backend/plugin/advisor/catalog"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
const (
@@ -21,10 +20,6 @@ var (
_ ast.Visitor = (*tableRequirePKChecker)(nil)
)
-func init() {
- advisor.Register(storepb.Engine_TIDB, advisor.MySQLTableRequirePK, &TableRequirePKAdvisor{})
-}
-
// TableRequirePKAdvisor is the advisor checking table requires PK.
type TableRequirePKAdvisor struct {
}
diff --git a/backend/plugin/advisor/mysqlwip/mysqlwip_rules_test.go b/backend/plugin/advisor/mysqlwip/mysqlwip_rules_test.go
new file mode 100644
index 0000000000..3b2ba5547d
--- /dev/null
+++ b/backend/plugin/advisor/mysqlwip/mysqlwip_rules_test.go
@@ -0,0 +1,19 @@
+package mysqlwip
+
+import (
+ "testing"
+
+ "github.com/bytebase/bytebase/backend/plugin/advisor"
+ storepb "github.com/bytebase/bytebase/proto/generated-go/store"
+)
+
+func TestMySQLWIPRules(t *testing.T) {
+ mysqlwipRules := []advisor.SQLReviewRuleType{
+ // advisor.SchemaRuleTableNaming enforce the table name format.
+ advisor.SchemaRuleTableNaming,
+ }
+
+ for _, rule := range mysqlwipRules {
+ advisor.RunSQLReviewRuleTest(t, rule, storepb.Engine_ENGINE_UNSPECIFIED, false /* record */)
+ }
+}
diff --git a/backend/plugin/advisor/mysqlwip/tidb_rules_tests.go b/backend/plugin/advisor/mysqlwip/tidb_rules_tests.go
deleted file mode 100644
index 51bc47c14a..0000000000
--- a/backend/plugin/advisor/mysqlwip/tidb_rules_tests.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package mysqlwip
-
-import (
- "testing"
-
- "github.com/bytebase/bytebase/backend/plugin/advisor"
- storepb "github.com/bytebase/bytebase/proto/generated-go/store"
-)
-
-func TestMySQLRules(t *testing.T) {
- tidbRules := []advisor.SQLReviewRuleType{
- // advisor.SchemaRuleTableNaming enforce the table name format.
- advisor.SchemaRuleTableNaming,
- // advisor.SchemaRuleColumnNaming enforce the column name format.
- advisor.SchemaRuleColumnNaming,
- // advisor.SchemaRuleUKNaming enforce the unique key name format.
- advisor.SchemaRuleUKNaming,
- // advisor.SchemaRuleFKNaming enforce the foreign key name format.
- advisor.SchemaRuleFKNaming,
- // advisor.SchemaRuleIDXNaming enforce the index name format.
- advisor.SchemaRuleIDXNaming,
- // advisor.SchemaRuleAutoIncrementColumnNaming enforce the auto_increment column name format.
- advisor.SchemaRuleAutoIncrementColumnNaming,
-
- // advisor.SchemaRuleStatementNoSelectAll disallow 'SELECT *'.
- advisor.SchemaRuleStatementNoSelectAll,
- // advisor.SchemaRuleStatementRequireWhere require 'WHERE' clause.
- advisor.SchemaRuleStatementRequireWhere,
- // advisor.SchemaRuleStatementNoLeadingWildcardLike disallow leading '%' in LIKE, e.g. LIKE foo = '%x' is not allowed.
- advisor.SchemaRuleStatementNoLeadingWildcardLike,
- // advisor.SchemaRuleStatementDisallowCommit disallow using commit in the issue.
- advisor.SchemaRuleStatementDisallowCommit,
- // advisor.SchemaRuleStatementDisallowLimit disallow the LIMIT clause in INSERT, DELETE and UPDATE statements.
- advisor.SchemaRuleStatementDisallowLimit,
- // advisor.SchemaRuleStatementDisallowOrderBy disallow the ORDER BY clause in DELETE and UPDATE statements.
- advisor.SchemaRuleStatementDisallowOrderBy,
- // advisor.SchemaRuleStatementMergeAlterTable disallow redundant ALTER TABLE statements.
- advisor.SchemaRuleStatementMergeAlterTable,
- // advisor.SchemaRuleStatementInsertMustSpecifyColumn enforce the insert column specified.
- advisor.SchemaRuleStatementInsertMustSpecifyColumn,
- // advisor.SchemaRuleStatementInsertDisallowOrderByRand disallow the order by rand in the INSERT statement.
- advisor.SchemaRuleStatementInsertDisallowOrderByRand,
- // advisor.SchemaRuleStatementAffectedRowLimit enforce the UPDATE/DELETE affected row limit.
- advisor.SchemaRuleStatementAffectedRowLimit,
- // advisor.SchemaRuleStatementDMLDryRun dry run the dml.
- advisor.SchemaRuleStatementDMLDryRun,
-
- // advisor.SchemaRuleTableRequirePK require the table to have a primary key.
- advisor.SchemaRuleTableRequirePK,
- // advisor.SchemaRuleTableNoFK require the table disallow the foreign key.
- advisor.SchemaRuleTableNoFK,
- // advisor.SchemaRuleTableDropNamingConvention require only the table following the naming convention can be deleted.
- advisor.SchemaRuleTableDropNamingConvention,
- // advisor.SchemaRuleTableCommentConvention enforce the table comment convention.
- advisor.SchemaRuleTableCommentConvention,
- // advisor.SchemaRuleTableDisallowPartition disallow the table partition.
- advisor.SchemaRuleTableDisallowPartition,
-
- // advisor.SchemaRuleRequiredColumn enforce the required columns in each table.
- advisor.SchemaRuleRequiredColumn,
- // advisor.SchemaRuleColumnNotNull enforce the columns cannot have NULL value.
- advisor.SchemaRuleColumnNotNull,
- // advisor.SchemaRuleColumnDisallowChangeType disallow change column type.
- advisor.SchemaRuleColumnDisallowChangeType,
- // advisor.SchemaRuleColumnSetDefaultForNotNull require the not null column to set default value.
- advisor.SchemaRuleColumnSetDefaultForNotNull,
- // advisor.SchemaRuleColumnDisallowChange disallow CHANGE COLUMN statement.
- advisor.SchemaRuleColumnDisallowChange,
- // advisor.SchemaRuleColumnDisallowChangingOrder disallow changing column order.
- advisor.SchemaRuleColumnDisallowChangingOrder,
- // advisor.SchemaRuleColumnDisallowDropIndex disallow drop index column.
- advisor.SchemaRuleColumnDisallowDropInIndex,
- // advisor.SchemaRuleColumnCommentConvention enforce the column comment convention.
- advisor.SchemaRuleColumnCommentConvention,
- // advisor.SchemaRuleColumnAutoIncrementMustInteger require the auto-increment column to be integer.
- advisor.SchemaRuleColumnAutoIncrementMustInteger,
- // advisor.SchemaRuleColumnTypeDisallowList enforce the column type disallow list.
- advisor.SchemaRuleColumnTypeDisallowList,
- // advisor.SchemaRuleColumnDisallowSetCharset disallow set column charset.
- advisor.SchemaRuleColumnDisallowSetCharset,
- // advisor.SchemaRuleColumnMaximumCharacterLength enforce the maximum character length.
- advisor.SchemaRuleColumnMaximumCharacterLength,
- // advisor.SchemaRuleColumnAutoIncrementInitialValue enforce the initial auto-increment value.
- advisor.SchemaRuleColumnAutoIncrementInitialValue,
- // advisor.SchemaRuleColumnAutoIncrementMustUnsigned enforce the auto-increment column to be unsigned.
- advisor.SchemaRuleColumnAutoIncrementMustUnsigned,
- // advisor.SchemaRuleCurrentTimeColumnCountLimit enforce the current column count limit.
- advisor.SchemaRuleCurrentTimeColumnCountLimit,
- // advisor.SchemaRuleColumnRequireDefault enforce the column default.
- advisor.SchemaRuleColumnRequireDefault,
-
- // advisor.SchemaRuleSchemaBackwardCompatibility enforce the MySQL and TiDB support check whether the schema change is backward compatible.
- advisor.SchemaRuleSchemaBackwardCompatibility,
-
- // advisor.SchemaRuleDropEmptyDatabase enforce the MySQL and TiDB support check if the database is empty before users drop it.
- advisor.SchemaRuleDropEmptyDatabase,
-
- // advisor.SchemaRuleIndexNoDuplicateColumn require the index no duplicate column.
- advisor.SchemaRuleIndexNoDuplicateColumn,
- // advisor.SchemaRuleIndexKeyNumberLimit enforce the index key number limit.
- advisor.SchemaRuleIndexKeyNumberLimit,
- // advisor.SchemaRuleIndexPKTypeLimit enforce the type restriction of columns in primary key.
- advisor.SchemaRuleIndexPKTypeLimit,
- // advisor.SchemaRuleIndexTypeNoBlob enforce the type restriction of columns in index.
- advisor.SchemaRuleIndexTypeNoBlob,
- // advisor.SchemaRuleIndexTotalNumberLimit enforce the index total number limit.
- advisor.SchemaRuleIndexTotalNumberLimit,
- advisor.SchemaRuleIndexPrimaryKeyTypeAllowlist,
-
- // advisor.SchemaRuleCharsetAllowlist enforce the charset allowlist.
- advisor.SchemaRuleCharsetAllowlist,
-
- // advisor.SchemaRuleCollationAllowlist enforce the collation allowlist.
- advisor.SchemaRuleCollationAllowlist,
- }
-
- for _, rule := range tidbRules {
- advisor.RunSQLReviewRuleTest(t, rule, storepb.Engine_TIDB, false /* record */)
- }
-}
diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.go
index 92e2561218..b6368bd6db 100644
--- a/backend/plugin/advisor/sql_review.go
+++ b/backend/plugin/advisor/sql_review.go
@@ -403,6 +403,9 @@ type SQLReviewCheckContext struct {
func syntaxCheck(statement string, checkContext SQLReviewCheckContext) (any, []Advice) {
switch checkContext.DbType {
+ // only for test mysqlwip.
+ case storepb.Engine_ENGINE_UNSPECIFIED:
+ return mysqlwipSyntaxCheck(statement)
case storepb.Engine_MYSQL, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE, storepb.Engine_TIDB:
return mysqlSyntaxCheck(statement)
case storepb.Engine_POSTGRES:
@@ -578,6 +581,36 @@ func newTiDBParser() *tidbparser.Parser {
return p
}
+// only for test mysqlwip.
+func mysqlwipSyntaxCheck(statement string) (any, []Advice) {
+ res, err := mysqlparser.ParseMySQL(statement + ";")
+ if err != nil {
+ if syntaxErr, ok := err.(*base.SyntaxError); ok {
+ return nil, []Advice{
+ {
+ Status: Warn,
+ Code: StatementSyntaxError,
+ Title: SyntaxErrorTitle,
+ Content: syntaxErr.Message,
+ Line: syntaxErr.Line,
+ Column: syntaxErr.Column,
+ },
+ }
+ }
+ return nil, []Advice{
+ {
+ Status: Warn,
+ Code: Internal,
+ Title: "Parse error",
+ Content: err.Error(),
+ Line: 1,
+ },
+ }
+ }
+
+ return res, nil
+}
+
func mysqlSyntaxCheck(statement string) (any, []Advice) {
list, err := mysqlparser.SplitSQL(statement)
if err != nil {
@@ -1031,6 +1064,9 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
}
case SchemaRuleTableNaming:
switch engine {
+ // only for test mysqlwip.
+ case storepb.Engine_ENGINE_UNSPECIFIED:
+ return MySQLNamingTableConvention, nil
case storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:
return MySQLNamingTableConvention, nil
case storepb.Engine_POSTGRES: