Migration scripts run during Matomo updates often contain MySQL specific DDL statements. Migrations are also run as part of the test suite setup. Alternative databases commonly have minor differences in schema structure and DDL statements, in order to support them we need an option for migration scripts to provide DDL statements for multiple databases if required.
Suggested Approach
Extend the core/Updates and core/Updater classes to allow each migration in the migrations array to be optionally associated with a specific database type.
// Current:return [
$this->migration->db->sql('UPDATE ' . $table . ' SET hash_algo = "sha512" where hash_algo is null')
];
// After rework:return [
'Mysql' => $this->migration->db->sql('UPDATE ' . $table . ' SET hash_algo = "sha512" where hash_algo is null'),
'TiDB' => $this->migration->db->sql('UPDATE ' . $table . ' SET hash_algo = "twofish" where hash_algo is null'),
];
// Works for all types:return [
'all' => $this->migration->db->sql('UPDATE ' . $table . ' SET hash_algo = "sha512" where hash_algo is null')
];
If 'all' is specified then the migration will run for any PDO adapter, if a database type is specified then the migration will only run if that PDO adapter is being used.
The Update files in core/Updates/ may then provide different schema changes for different db types if needed.
Rework all existing migrations to use the new format.
As old migrations are re-run during integration tests, future database support may involve retrospectively adding database specific DDL to existing migrations as required.
The text was updated successfully, but these errors were encountered:
bx80
added
the
Enhancement
For new feature suggestions that for example enhance Matomo's cabapilities..
label
Aug 19, 2022
Migration scripts run during Matomo updates often contain MySQL specific DDL statements. Migrations are also run as part of the test suite setup. Alternative databases commonly have minor differences in schema structure and DDL statements, in order to support them we need an option for migration scripts to provide DDL statements for multiple databases if required.
Suggested Approach
core/Updates
andcore/Updater
classes to allow each migration in the migrations array to be optionally associated with a specific database type.If 'all' is specified then the migration will run for any PDO adapter, if a database type is specified then the migration will only run if that PDO adapter is being used.
The Update files in
core/Updates/
may then provide different schema changes for different db types if needed.Rework all existing migrations to use the new format.
As old migrations are re-run during integration tests, future database support may involve retrospectively adding database specific DDL to existing migrations as required.
The text was updated successfully, but these errors were encountered: