diff --git a/composer.json b/composer.json index 3fe2065..f24e4b4 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "codesvault/howdy-qb", "description": "Mysql Query Builder for WordPress", - "version": "1.5.1", + "version": "1.5.2", "minimum-stability": "stable", "scripts": { "test": "phpunit", diff --git a/src/Api/CreateInterface.php b/src/Api/CreateInterface.php index e9b64e4..af4500a 100644 --- a/src/Api/CreateInterface.php +++ b/src/Api/CreateInterface.php @@ -40,6 +40,8 @@ public function default($value): self; public function foreignKey(string $column, string $reference_table, string $reference_column): self; + public function onDelete(string $action): self; + public function getSql(); public function execute(); diff --git a/src/Statement/Create.php b/src/Statement/Create.php index 932c394..90dc79b 100644 --- a/src/Statement/Create.php +++ b/src/Statement/Create.php @@ -3,7 +3,6 @@ namespace CodesVault\Howdyqb\Statement; use CodesVault\Howdyqb\Api\CreateInterface; -use CodesVault\Howdyqb\QueryFactory; use CodesVault\Howdyqb\SqlGenerator; use CodesVault\Howdyqb\Utilities; @@ -139,6 +138,12 @@ public function foreignKey(string $column, string $reference_table, string $refe return $this; } + public function onDelete(string $action): self + { + $this->sql['onDelete'] = "ON DELETE $action"; + return $this; + } + protected function start() { $this->sql['start'] = 'CREATE TABLE IF NOT EXISTS';