Skip to content

Migrations randomly failing, no way to troubleshoot #139

@vpithart

Description

@vpithart

Issue 1: Some migrations fail without apparent reason.

Here's the migration SQL (/db/structures/2024-12-07-134509-dokumenty.sql)

CREATE TABLE Dokument (
    id INT AUTO_INCREMENT PRIMARY KEY,
    event1_time TIMESTAMP,
    event2_time TIMESTAMP
);

☝ tested in MySQL CLI and works.

On running php www/index.php migrations:continue it fails:
ERROR: Executing migration "../db/structures/2024-12-07-134509-dokumenty.sql" has failed.

Issue 2: There's no way to tell why.

The error output is completely useless and provides no clue on what's wrong:

$ php www/index.php migrations:continue 
Nextras Migrations
CONTINUE
2 migrations need to be executed.
ERROR: Executing migration "../db/structures/2024-12-07-134509-dokumenty.sql" has failed.
[10-Dec-2024 13:51:59 Europe/Prague] PHP Fatal error:  Uncaught TypeError: Cannot assign bool to property Nette\Application\Application::$errorPresenter of type ?string in /opt/.../temp/cache/nette.configurator/Container_2dae16c776.php:1990
Stack trace:
#0 /opt/.../vendor/nette/utils/src/Utils/Arrays.php(491): Container_2dae16c776->{closure}()
#1 /opt/.../vendor/nette/application/src/Application/Application.php(81): Nette\Utils\Arrays::invoke()
#2 /opt/.../www/index.php(9): Nette\Application\Application->run()
#3 {main}
  thrown in /opt/.../temp/cache/nette.configurator/Container_2dae16c776.php on line 1990

This output is the same no matter what the SQL file actually contains. Valid SQL, invalid SQL, even with any gibberish -- no useless error message.

Versions

PHP 8.2.26
"nextras/migrations": "^3.3",
"nette/database": "~3.2.0",

config.neon:

migrations:
    dir: %appDir%/../db         # migrations base directory
    driver: mysql               # pgsql or mysql
    dbal: nette                 # nextras, nette, doctrine or dibi

Database Server version: 10.1.48-MariaDB-1~bionic mariadb.org binary distribution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions