Browse Source

Fix sqlite fixture generation

Mark Scherer 11 years ago
parent
commit
47cad96da0
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/Database/Schema/SqliteSchema.php

+ 6 - 2
src/Database/Schema/SqliteSchema.php

@@ -253,13 +253,17 @@ class SqliteSchema extends BaseSchema
         if (in_array($data['type'], $hasUnsigned, true) &&
             isset($data['unsigned']) && $data['unsigned'] === true
         ) {
-            $out .= ' UNSIGNED';
+            if ($data['type'] !== 'integer' || [$name] !== (array)$table->primaryKey()) {
+                $out .= ' UNSIGNED';
+            }
         }
         $out .= $typeMap[$data['type']];
 
         $hasLength = ['integer', 'string'];
         if (in_array($data['type'], $hasLength, true) && isset($data['length'])) {
-            $out .= '(' . (int)$data['length'] . ')';
+            if ($data['type'] !== 'integer' || [$name] !== (array)$table->primaryKey()) {
+                $out .= '(' . (int)$data['length'] . ')';
+            }
         }
         $hasPrecision = ['float', 'decimal'];
         if (in_array($data['type'], $hasPrecision, true) &&