Skip to content

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

Add a setting table to bytebase database installed on user’s instance

天舟946619451f73
diff --git a/db/mysql_migration_schema.sql b/db/mysql_migration_schema.sql
index 5bc47ad395..29f15bb168 100644
--- a/db/mysql_migration_schema.sql
+++ b/db/mysql_migration_schema.sql
@@ -2,6 +2,41 @@
-- Create a database called bytebase
CREATE DATABASE bytebase CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
+CREATE TABLE bytebase.setting (
+ id INTEGER PRIMARY KEY AUTO_INCREMENT,
+ created_by TEXT NOT NULL,
+ created_ts BIGINT NOT NULL,
+ updated_by TEXT NOT NULL,
+ updated_ts BIGINT NOT NULL,
+ name TEXT NOT NULL,
+ value TEXT NOT NULL,
+ description TEXT NOT NULL
+);
+
+CREATE UNIQUE INDEX bytebase_idx_unique_setting_name ON bytebase.setting (name(256));
+
+-- Insert schema version 1
+INSERT INTO
+ bytebase.setting (
+ created_by,
+ created_ts,
+ updated_by,
+ updated_ts,
+ name,
+ value,
+ description
+ )
+VALUES
+ (
+ 'bytebase',
+ UNIX_TIMESTAMP(),
+ 'bytebase',
+ UNIX_TIMESTAMP(),
+ 'bb.schema.version',
+ '1',
+ 'Schema version'
+ );
+
-- Create migration_history table
-- Note, we don't create trigger to update created_ts and updated_ts because that may causes error:
-- ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)