diff --git a/mintlify/change-database/settings.mdx b/mintlify/change-database/settings.mdx index e617fcf0b..3829f382c 100644 --- a/mintlify/change-database/settings.mdx +++ b/mintlify/change-database/settings.mdx @@ -4,21 +4,6 @@ title: Settings Customize how database changes work in your projects. Navigate to **Project** → **Settings** to access these options. -## Transaction Mode - - -Supported databases: MySQL, PostgreSQL, Oracle, SQL Server, TiDB, Redshift - - -By default, Bytebase wraps SQL statements in a transaction for safety - if something goes wrong, changes can be rolled back. - -Some DDL statements can't run inside transactions. To disable transaction wrapping, add this comment before your SQL: - -```sql --- txn-mode=off -ALTER TABLE t ALTER COLUMN a TYPE VARCHAR(255); -``` - ## Postgres Tenant Mode Perfect for multi-tenant PostgreSQL setups where each database has its own owner. diff --git a/mintlify/change-database/transaction-mode.mdx b/mintlify/change-database/transaction-mode.mdx new file mode 100644 index 000000000..dea979e89 --- /dev/null +++ b/mintlify/change-database/transaction-mode.mdx @@ -0,0 +1,39 @@ +--- +title: Transaction Mode +--- + + +Supported databases: MySQL, PostgreSQL, Oracle, SQL Server, TiDB, Redshift + + +Bytebase provides transaction management to ensure safe database changes. By default, all SQL statements are wrapped in a transaction, allowing automatic rollback if errors occur during execution. + +## Enable/Disable Transactions + +When creating a plan, you can control whether SQL statements are executed within a transaction: + +- **Enabled (default)**: All statements run within a transaction boundary for safety +- **Disabled**: Statements execute directly without transaction wrapping + +![Transaction mode toggle](/content/docs/change-database/transaction-mode/bb-transaction-mode.webp) + +## MySQL-Specific Settings + +For MySQL databases, Bytebase offers additional control over transaction isolation levels to manage concurrent access and data consistency: + +![MySQL transaction isolation levels](/content/docs/change-database/transaction-mode/bb-transaction-mode-mysql.webp) + +### Available Isolation Levels + +- **READ UNCOMMITTED**: Lowest isolation, allows dirty reads +- **READ COMMITTED**: Prevents dirty reads, allows non-repeatable reads +- **REPEATABLE READ**: Default MySQL isolation, prevents dirty and non-repeatable reads +- **SERIALIZABLE**: Highest isolation, prevents all phenomena but may impact performance + +## Best Practices + +- Keep transactions enabled for DDL and DML operations that modify data +- Consider disabling transactions only for: + - Large batch operations that manage their own transaction boundaries + - Statements that cannot run within transactions (e.g., certain administrative commands) +- Choose appropriate isolation levels based on your concurrency requirements and performance needs diff --git a/mintlify/content/docs/change-database/transaction-mode/bb-transaction-mode-mysql.webp b/mintlify/content/docs/change-database/transaction-mode/bb-transaction-mode-mysql.webp new file mode 100644 index 000000000..e7e1f4fd5 Binary files /dev/null and b/mintlify/content/docs/change-database/transaction-mode/bb-transaction-mode-mysql.webp differ diff --git a/mintlify/content/docs/change-database/transaction-mode/bb-transaction-mode.webp b/mintlify/content/docs/change-database/transaction-mode/bb-transaction-mode.webp new file mode 100644 index 000000000..a0d31970d Binary files /dev/null and b/mintlify/content/docs/change-database/transaction-mode/bb-transaction-mode.webp differ diff --git a/mintlify/docs.json b/mintlify/docs.json index ff5eb4155..b85a85f4d 100644 --- a/mintlify/docs.json +++ b/mintlify/docs.json @@ -95,6 +95,7 @@ "group": "Change", "pages": [ "change-database/plan", + "change-database/transaction-mode", "change-database/batch-change", "change-database/synchronize-schema", "change-database/online-schema-migration-for-mysql",