Skip to main content

Bench Transform Database

The bench transform-database command allows you to modify the storage engine and row format of database tables in a Frappe site. It is primarily used during database maintenance and MariaDB upgrades to ensure compatibility with newer database versions.

Important:

This command is available from Frappe Version 14 onwards and currently supports MariaDB databases only.

Usage

bench transform-database [OPTIONS]

What Does This Command Do?

The command lets you update database table settings without manually executing SQL statements. You can:

  • Change the storage engine of one or more tables.
  • Modify the table ROW_FORMAT.
  • Apply changes to a specific table or every table in the site database.

Why is this useful?

MariaDB 10.6 deprecated the COMPRESSED row format, which was previously the default in Frappe. This command simplifies migrating existing tables to supported formats such as DYNAMIC.

Available Options

Option Description
--table Comma-separated list of tables to transform. Use all to update every table. Required.
--engine Change the storage engine. Supported values are InnoDB and MyISAM.
--row_format Set the table row format. Supported values are DYNAMIC, COMPACT, REDUNDANT, and COMPRESSED.

Available Flag

Flag Description
--failfast Stops execution immediately if any table transformation fails.

Common Examples

Change the Storage Engine of a Table

Convert the tabAccess Record table to the MyISAM storage engine.

bench --site {site} transform-database \
--table "tabAccess Record" \
--engine MyISAM

This can be useful for log tables that receive a high volume of write operations and minimal read activity.

Convert All Tables to the DYNAMIC Row Format

After upgrading MariaDB from version 10.3 to 10.7, convert all tables using the deprecated COMPRESSED row format to the recommended DYNAMIC format.

bench --site {site} transform-database \
--table all \
--row_format DYNAMIC

This updates every table in the site database to use the newer row format supported by recent MariaDB versions.

Best Practice:

Always create a complete database backup before transforming table engines or row formats. Although the command automates the process, structural changes to database tables should be performed with a reliable backup available.

Rating: 0 / 5 (0 votes)