Found this error during migration proccess:
== 20250121120000 UpsertCoreEmergencyAlertInModule: migrating
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘AS newRow
ON DUPLICATE KEY UPDATE
enabled = new…’ at line 2 in C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php:192
Stack trace:
#0 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\PdoAdapter.php(192): PDO->exec()
#1 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Db\Adapter\AdapterWrapper.php(157): Phinx\Db\Adapter\PdoAdapter->execute()
#2 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Migration\AbstractMigration.php(199): Phinx\Db\Adapter\AdapterWrapper->execute()
#3 C:\Files\CMS\MYCMS.COM\db\migrations\20250121120000_upsert_core_emergency_alert_in_module.php(34): Phinx\Migration\AbstractMigration->execute()
#4 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Migration\Manager\Environment.php(108): UpsertCoreEmergencyAlertInModule->change()
#5 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Migration\Manager.php(388): Phinx\Migration\Manager\Environment->executeMigration()
#6 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Migration\Manager.php(359): Phinx\Migration\Manager->executeMigration()
#7 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Console\Command\Migrate.php(122): Phinx\Migration\Manager->migrate()
#8 C:\Files\CMS\MYCMS.COM\vendor\symfony\console\Command\Command.php(298): Phinx\Console\Command\Migrate->execute()
#9 C:\Files\CMS\MYCMS.COM\vendor\symfony\console\Application.php(1040): Symfony\Component\Console\Command\Command->run()
#10 C:\Files\CMS\MYCMS.COM\vendor\symfony\console\Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#11 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\src\Phinx\Console\PhinxApplication.php(70): Symfony\Component\Console\Application->doRun()
#12 C:\Files\CMS\MYCMS.COM\vendor\symfony\console\Application.php(171): Phinx\Console\PhinxApplication->doRun()
#13 C:\Files\CMS\MYCMS.COM\vendor\robmorgan\phinx\bin\phinx(28): Symfony\Component\Console\Application->run()
#14 C:\Files\CMS\MYCMS.COM\vendor\bin\phinx(119): include(‘…’)
#15 {main}
i’m using MariaDB 10.7.4
Had to change the migration file \db\migrations\20250115120000_add_national_weather_service_connector_migration.php
from
$this->execute('
INSERT INTO `module` (`moduleId`, `enabled`, `previewEnabled`, `defaultDuration`, `settings`)
VALUES (\'core-emergency-alert\', \'1\', \'1\', \'60\', NULL) AS newRow
ON DUPLICATE KEY UPDATE
`enabled` = newRow.enabled,
`previewEnabled` = newRow.previewEnabled,
`defaultDuration` = newRow.defaultDuration,
`settings` = newRow.settings;
');
To
public function change(): void
{
// Insert or update core-emergency-alert into the module table
$this->execute('
INSERT INTO `module` (`moduleId`, `enabled`, `previewEnabled`, `defaultDuration`, `settings`)
VALUES (\'core-emergency-alert\', \'1\', \'1\', \'60\', NULL)
ON DUPLICATE KEY UPDATE
`enabled` = VALUES(`enabled`),
`previewEnabled` = VALUES(`previewEnabled`),
`defaultDuration` = VALUES(`defaultDuration`),
`settings` = VALUES(`settings`);
');
Since MariaDB does not allow AS newRow