migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Migrations execution_time should be integer in order to be compatible with GCP Spanner

Open gabrielfs7 opened this issue 4 years ago • 2 comments

Bug Report

I am currently receiving error from GCP when trying to persist data using Spanner:

An exception occurred while executing 'INSERT INTO doctrine_migration_versions (version, executed_at, execution_time) VALUES (?, ?, ?)' with params ["oat\\generis\\migrations\\Version202009301828472348_generis", "2020-10-02T11:54:13.671062Z", 130]:  
                                                                                                                                                                                                                                                            
  {                                                                                                                                                                                                                                                         
      "message": "Invalid value for bind parameter param3: Expected INT64.",                                                                                                                                                                                
      "code": 3,                                                                                                                                                                                                                                            
      "status": "INVALID_ARGUMENT",                                                                                                                                                                                                                         
      "details": [                                                                                                                                                                                                                                          
          {                                                                                                                                                                                                                                                 
              "@type": "grpc-server-stats-bin",                                                                                                                                                                                                             
              "data": "<Unknown Binary Data>"                                                                                                                                                                                                               
          }                                                                                                                                                                                                                                                 
      ]                                                                                                                                                                                                                                                     
  }        

Cause the 130 is actually 130.0 (a float).

Since migrations always expects an integer here I would like to cast this value to avoid driver incompatibilities

Just created a PR for this https://github.com/doctrine/migrations/pull/1060

Q A
BC Break no
Version >= 3. / master

Summary

Library delegates to DB to cast float to integer while inserting migrations. This causes issues when integrating with GCP Spanner.

Current behavior

The migrations record cannot be persisted.

How to reproduce

  1. Have a migrations table on GCP Spanner
  2. Run migrations

Expected behavior

The data should be persisted in the migrations table.

gabrielfs7 avatar Oct 02 '20 11:10 gabrielfs7

it is happening to me also , i saw the fix and i think it is quite small and will be a great progress

Is there any estimation how can we merge this bugfix? https://github.com/doctrine/migrations/pull/1060

gabrielfs7 avatar Oct 12 '20 11:10 gabrielfs7