Check if foreign key has an action
authorMatthias Schmidt <gravatronics@live.com>
Sun, 8 Sep 2019 13:05:02 +0000 (15:05 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 8 Sep 2019 13:05:02 +0000 (15:05 +0200)
wcfsetup/install/files/lib/system/database/table/DatabaseTable.class.php

index bc6c9c3f173542ed542285aaa0966d6b8a5769ba..9ef900887de78721de4c92fbc698decfeaa10f96 100644 (file)
@@ -102,6 +102,10 @@ class DatabaseTable {
                                throw new \InvalidArgumentException("Duplicate foreign key with name '{$foreignKey->getName()}'.");
                        }
                        
+                       if ($foreignKey->getOnDelete() === null && $foreignKey->getOnUpdate() === null) {
+                               throw new \InvalidArgumentException("Missing action for foreign key '{$foreignKey->getName()}'.");
+                       }
+                       
                        $this->foreignKeys[$foreignKey->getName()] = $foreignKey;
                }