Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$type of 'tel' leads to out of range error #262

Open
oknate opened this issue Apr 17, 2023 · 1 comment
Open

$type of 'tel' leads to out of range error #262

oknate opened this issue Apr 17, 2023 · 1 comment

Comments

@oknate
Copy link

oknate commented Apr 17, 2023

When running the migration with 2.0.0-rc.2
Exception: SQLSTATE[22003]: Numeric value out of range: 7 ERROR: value "+33149544600" is out of range for type integer
The SQL being executed was: SELECT EXISTS(SELECT "id"
FROM "elements"
WHERE "id"='+33149544600') (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:676)

The problem is it tries to put the value as a key in the linkedSiteId column, but this only accepts integers

@oknate
Copy link
Author

oknate commented Apr 17, 2023

This code got us around the error:

@@ -145,7 +164,8 @@ class m190417_202153_migrateDataToTable extends Migration
       unset($payload['type']);
       unset($payload['value']);

-      if ($value && is_numeric($value)) {
+
+      if ($type !== 'tel' && $value && is_numeric($value)) {
         $doesExist = (new Query())
           ->select('id')
           ->where(['id' => $value])
@@ -157,6 +177,10 @@ class m190417_202153_migrateDataToTable extends Migration
         }
       }

+      if ($type === 'tel') {
+        $value = '';
+      }
+
       $insertRows[] = [
         $row['elementId'],                          // elementId
         $row['siteId'],                             // siteId

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant