Skip to content

Avoid false which is mangled by PDO#1023

Merged
markstory merged 9 commits intocakephp:5.xfrom
QoboLtd:fix-postgres-upgrade
Feb 20, 2026
Merged

Avoid false which is mangled by PDO#1023
markstory merged 9 commits intocakephp:5.xfrom
QoboLtd:fix-postgres-upgrade

Conversation

@nicosp
Copy link
Copy Markdown
Contributor

@nicosp nicosp commented Feb 18, 2026

Fix migrations upgrade with postgres which has native booleans.

Fixes: #1022

@dereuromark
Copy link
Copy Markdown
Member

Is there a test case we might be missing?

@dereuromark
Copy link
Copy Markdown
Member

dereuromark commented Feb 18, 2026

One suggestion: the current fix handles false but not true. If a breakpoint is set, PostgreSQL would return true which could also be mangled by PDO.

A simpler approach that handles all cases:

'breakpoint' => (int)($row['breakpoint'] ?? 0),

This is also consistent with how breakpoint is used elsewhere in MigrationsTableStorage.php (lines 105, 180).

@nicosp
Copy link
Copy Markdown
Contributor Author

nicosp commented Feb 19, 2026

Another approach that works is to pass the column type in the insertQuery.

        $schema = $connection->getSchemaCollection()->describe($unifiedTable);

        // Insert into unified table
        foreach ($rows as $row) {
            try {
                $insertQuery = $connection->insertQuery()
                    ->insert(
                        ['version', 'migration_name', 'plugin', 'start_time', 'end_time', 'breakpoint'],
                        [
                            'breakpoint' => $schema->getColumnType('breakpoint'),
                        ]
                    )
...

I am not sure if there is an easier way to do this.

@nicosp nicosp force-pushed the fix-postgres-upgrade branch from e3d4558 to 8ac1f25 Compare February 19, 2026 09:42
@nicosp
Copy link
Copy Markdown
Contributor Author

nicosp commented Feb 19, 2026

The pipelines for mariadb seem to be stuck

@LordSimal
Copy link
Copy Markdown
Contributor

MariaDB needs the same fix from cakephp/cakephp#19273 as that action is broken

@markstory markstory merged commit 304c597 into cakephp:5.x Feb 20, 2026
14 of 16 checks passed
@markstory
Copy link
Copy Markdown
Member

Thanks! We can get mariadb fixed separately.

@nicosp
Copy link
Copy Markdown
Contributor Author

nicosp commented Feb 20, 2026

@markstory Might have merged part of the fix.

The last part:

docker exec mariadb mariadb -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp_comparisons;'
docker exec mariadb mariadb -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp_snapshot;'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrations Upgrade did not work for postgres / secondary datasource

4 participants