Skip to content

Avoid false which is mangled by PDO#1023

Open
nicosp wants to merge 8 commits intocakephp:5.xfrom
QoboLtd:fix-postgres-upgrade
Open

Avoid false which is mangled by PDO#1023
nicosp wants to merge 8 commits intocakephp:5.xfrom
QoboLtd:fix-postgres-upgrade

Conversation

@nicosp
Copy link
Contributor

@nicosp nicosp commented Feb 18, 2026

Fix migrations upgrade with postgres which has native booleans.

Fixes: #1022

@dereuromark
Copy link
Member

Is there a test case we might be missing?

@dereuromark
Copy link
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
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
Contributor Author

nicosp commented Feb 19, 2026

The pipelines for mariadb seem to be stuck

@LordSimal
Copy link
Contributor

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

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

3 participants

Comments