Skip to content

Commit 9dbeae0

Browse files
committed
Code review comments.
1 parent fdeec5e commit 9dbeae0

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

lib/Cake/Database/Schema/Collection.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ public function describe($name) {
119119
*/
120120
protected function _executeSql($sql, $params) {
121121
try {
122-
$statement = $this->_connection->execute($sql, $params);
123-
return $statement;
122+
return $this->_connection->execute($sql, $params);
124123
} catch (\PDOException $e) {
125124
throw new Exception($e->getMessage(), 500, $e);
126125
}

lib/Cake/Database/Schema/SqliteSchema.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ protected function _convertOnClause($clause) {
231231
if ($clause === 'NO ACTION') {
232232
return 'none';
233233
}
234-
if ($clause === 'SET NULL') {
235-
return null;
236-
}
234+
return null;
237235
}
238236

239237
/**

lib/Cake/Database/Schema/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ class Table {
9393
'columns' => [],
9494
'length' => [],
9595
'references' => [],
96-
'update' => 'cascade',
97-
'delete' => 'cascade',
96+
'update' => 'restrict',
97+
'delete' => 'restrict',
9898
];
9999

100100
/**

lib/Cake/Test/TestCase/Database/Schema/SqliteSchemaTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,25 +477,31 @@ public static function constraintSqlProvider() {
477477
'author_id_idx',
478478
['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id']],
479479
'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' .
480-
'REFERENCES "authors" ("id") ON UPDATE CASCADE ON DELETE CASCADE'
480+
'REFERENCES "authors" ("id") ON UPDATE RESTRICT ON DELETE RESTRICT'
481+
],
482+
[
483+
'author_id_idx',
484+
['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id'], 'update' => 'cascade'],
485+
'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' .
486+
'REFERENCES "authors" ("id") ON UPDATE CASCADE ON DELETE RESTRICT'
481487
],
482488
[
483489
'author_id_idx',
484490
['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id'], 'update' => 'restrict'],
485491
'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' .
486-
'REFERENCES "authors" ("id") ON UPDATE RESTRICT ON DELETE CASCADE'
492+
'REFERENCES "authors" ("id") ON UPDATE RESTRICT ON DELETE RESTRICT'
487493
],
488494
[
489495
'author_id_idx',
490496
['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id'], 'update' => null],
491497
'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' .
492-
'REFERENCES "authors" ("id") ON UPDATE SET NULL ON DELETE CASCADE'
498+
'REFERENCES "authors" ("id") ON UPDATE SET NULL ON DELETE RESTRICT'
493499
],
494500
[
495501
'author_id_idx',
496502
['type' => 'foreign', 'columns' => ['author_id'], 'references' => ['authors', 'id'], 'update' => 'none'],
497503
'CONSTRAINT "author_id_idx" FOREIGN KEY ("author_id") ' .
498-
'REFERENCES "authors" ("id") ON UPDATE NO ACTION ON DELETE CASCADE'
504+
'REFERENCES "authors" ("id") ON UPDATE NO ACTION ON DELETE RESTRICT'
499505
],
500506
];
501507
}

0 commit comments

Comments
 (0)