Introduction
Introduction
In the software development lifecycle, the management of database settings plays a crucial role. In Version 14 of Empress, we introduced the transform-database command, a vital tool for managing the settings of your site’s tables. This command is specifically designed to support MariaDB, allowing developers to switch engines and row_format settings for select tables on your site database.
Key Functionalities and Advantages
The transform-database command offers developers the flexibility to manage database settings by converting tables, choosing a storage engine, and setting the ROW_FORMAT parameter. By doing so, developers can tailor their database structures to align with their unique business requirements, thereby enhancing overall software performance.
Command Usage
To use this command, you need to input the command syntax as follows:
bench transform-database [OPTIONS] table
Description
The transform-database command is specifically designed to manage the settings of your site’s tables. This includes the ability to switch between engines and the row_format settings for specific tables in your site’s database.
It’s important to note that MariaDB 10.6 deprecated the COMPRESSED ROW_FORMAT, which was Empress’ default option for a significant period. The transform-database command was introduced to facilitate upgrades to later versions of MariaDB, ensuring seamless transitions without data loss or processing interruptions.
Options
The transform-database command offers the following options:
-
--table: This option requires a comma-separated name of tables for conversion. To convert all tables, you can simply pass ‘all’. This is a required field. -
--engine: This option allows you to choose a storage engine for the specified table(s). The available options are InnoDB and MyISAM. -
--row_format: This option enables you to set the ROW_FORMAT parameter for the specified table(s). The available options are DYNAMIC, COMPACT, REDUNDANT, COMPRESSED.
Flags
The command also supports the failfast flag, which allows the operation to exit on the first failure occurred.
Examples
Consider two potential scenarios:
- You want to change the engine of a table “tabAccess Record” to
MyISAM. This could be beneficial if it’s a log table dealing with significant volumes of writes and minimal reads. In this case, you would run the following command:
bench --site {site} transform-database --table 'tabAccess Record' --engine 'MyISAM'
- You’ve upgraded MariaDB on your current server from 10.3 to 10.7. You need to convert all tables that used the COMPRESSED row_format to the new default, i.e.,
DYNAMIC. Here, you would run the following command:
bench --site {site} transform-database --table 'all' --row_format 'DYNAMIC'
Conclusion
The transform-database command provides a powerful tool for developers, allowing for seamless database management and customization. With it, you can optimize your database structure and performance, ultimately contributing to the development of tailored business solutions that align with your specific needs.