Browse Source

fixes unknown hash index errors when working with unique and overlapping foreign keys in postgres

Jonas Hartmann 10 years ago
parent
commit
9b57973ff2
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/Database/Schema/Table.php

+ 6 - 4
src/Database/Schema/Table.php

@@ -603,10 +603,12 @@ class Table
                     $attrs['columns']
                 ));
 
-                $this->_constraints[$name]['references'][1] = array_unique(array_merge(
-                    (array)$this->_constraints[$name]['references'][1],
-                    [$attrs['references'][1]]
-                ));
+                if (isset($this->_constraints[$name]['references'])) {
+                    $this->_constraints[$name]['references'][1] = array_unique(array_merge(
+                        (array)$this->_constraints[$name]['references'][1],
+                        [$attrs['references'][1]]
+                    ));
+                }
                 return $this;
             }
         } else {