Skip to content

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

chore: no bytebase prefix (#16881)

Danny Xu71d97d634fe1
diff --git a/backend/plugin/parser/base/transaction_mode.go b/backend/plugin/parser/base/transaction_mode.go
index d07cdc43e6..fd72e8e7de 100644
--- a/backend/plugin/parser/base/transaction_mode.go
+++ b/backend/plugin/parser/base/transaction_mode.go
@@ -18,11 +18,11 @@ const (
)
// txnModeDirectiveRegex matches the transaction mode directive at the beginning of a SQL script.
-// Format: -- bytebase:txn-mode = on|off
-var txnModeDirectiveRegex = regexp.MustCompile(`(?i)^\s*--\s*bytebase:txn-mode\s*=\s*(on|off)\s*$`)
+// Format: -- txn-mode = on|off
+var txnModeDirectiveRegex = regexp.MustCompile(`(?i)^\s*--\s*txn-mode\s*=\s*(on|off)\s*$`)
// ParseTransactionMode extracts the transaction mode directive from the SQL script.
-// It checks the first line of the script for the -- bytebase:txn-mode = on|off directive.
+// It checks the first line of the script for the -- txn-mode = on|off directive.
// Returns the transaction mode and the SQL script without the directive.
func ParseTransactionMode(script string) (TransactionMode, string) {
lines := strings.Split(script, "\n")
diff --git a/backend/plugin/parser/base/transaction_mode_test.go b/backend/plugin/parser/base/transaction_mode_test.go
index 39d9fd047c..90fdabf859 100644
--- a/backend/plugin/parser/base/transaction_mode_test.go
+++ b/backend/plugin/parser/base/transaction_mode_test.go
@@ -13,25 +13,25 @@ func TestParseTransactionMode(t *testing.T) {
}{
{
name: "transaction mode on",
- script: "-- bytebase:txn-mode = on\nCREATE TABLE foo (id INT);",
+ script: "-- txn-mode = on\nCREATE TABLE foo (id INT);",
expectedMode: TransactionModeOn,
expectedScript: "CREATE TABLE foo (id INT);",
},
{
name: "transaction mode off",
- script: "-- bytebase:txn-mode = off\nCREATE INDEX CONCURRENTLY idx ON foo(id);",
+ script: "-- txn-mode = off\nCREATE INDEX CONCURRENTLY idx ON foo(id);",
expectedMode: TransactionModeOff,
expectedScript: "CREATE INDEX CONCURRENTLY idx ON foo(id);",
},
{
name: "transaction mode uppercase",
- script: "-- BYTEBASE:TXN-MODE = OFF\nVACUUM ANALYZE;",
+ script: "-- TXN-MODE = OFF\nVACUUM ANALYZE;",
expectedMode: TransactionModeOff,
expectedScript: "VACUUM ANALYZE;",
},
{
name: "transaction mode with extra spaces",
- script: " -- bytebase:txn-mode = on \nINSERT INTO foo VALUES (1);",
+ script: " -- txn-mode = on \nINSERT INTO foo VALUES (1);",
expectedMode: TransactionModeOn,
expectedScript: "INSERT INTO foo VALUES (1);",
},
@@ -43,15 +43,15 @@ func TestParseTransactionMode(t *testing.T) {
},
{
name: "transaction mode not on first line",
- script: "CREATE TABLE baz (id INT);\n-- bytebase:txn-mode = on\nINSERT INTO baz VALUES (1);",
+ script: "CREATE TABLE baz (id INT);\n-- txn-mode = on\nINSERT INTO baz VALUES (1);",
expectedMode: TransactionModeUnspecified,
- expectedScript: "CREATE TABLE baz (id INT);\n-- bytebase:txn-mode = on\nINSERT INTO baz VALUES (1);",
+ expectedScript: "CREATE TABLE baz (id INT);\n-- txn-mode = on\nINSERT INTO baz VALUES (1);",
},
{
name: "invalid transaction mode value",
- script: "-- bytebase:txn-mode = maybe\nCREATE TABLE qux (id INT);",
+ script: "-- txn-mode = maybe\nCREATE TABLE qux (id INT);",
expectedMode: TransactionModeUnspecified,
- expectedScript: "-- bytebase:txn-mode = maybe\nCREATE TABLE qux (id INT);",
+ expectedScript: "-- txn-mode = maybe\nCREATE TABLE qux (id INT);",
},
{
name: "empty script",
@@ -61,13 +61,13 @@ func TestParseTransactionMode(t *testing.T) {
},
{
name: "only directive",
- script: "-- bytebase:txn-mode = on",
+ script: "-- txn-mode = on",
expectedMode: TransactionModeOn,
expectedScript: "",
},
{
name: "multiline script with directive",
- script: "-- bytebase:txn-mode = off\nCREATE TABLE t1 (id INT);\n\nCREATE TABLE t2 (id INT);\n-- This is a comment\nINSERT INTO t1 VALUES (1);",
+ script: "-- txn-mode = off\nCREATE TABLE t1 (id INT);\n\nCREATE TABLE t2 (id INT);\n-- This is a comment\nINSERT INTO t1 VALUES (1);",
expectedMode: TransactionModeOff,
expectedScript: "CREATE TABLE t1 (id INT);\n\nCREATE TABLE t2 (id INT);\n-- This is a comment\nINSERT INTO t1 VALUES (1);",
},