Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Accomodate older versions of SQLite.
SQLite prior to 3.6 does not support reflecting foreign key
update/delete properties. Conditionally parsing them is better than
notice errors.

Refs #6230
  • Loading branch information
markstory committed Apr 9, 2015
1 parent c73495d commit 8fe26ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Database/Schema/SqliteSchema.php
Expand Up @@ -207,12 +207,14 @@ public function describeForeignKeySql($tableName, $config)
*/
public function convertForeignKeyDescription(Table $table, $row)
{
$update = isset($row['on_update']) ? $row['on_update'] : '';
$delete = isset($row['on_delete']) ? $row['on_delete'] : '';
$data = [
'type' => Table::CONSTRAINT_FOREIGN,
'columns' => [$row['from']],
'references' => [$row['table'], $row['to']],
'update' => $this->_convertOnClause($row['on_update']),
'delete' => $this->_convertOnClause($row['on_delete']),
'update' => $this->_convertOnClause($update),
'delete' => $this->_convertOnClause($delete),
];
$name = $row['from'] . '_fk';
$table->addConstraint($name, $data);
Expand Down

0 comments on commit 8fe26ed

Please sign in to comment.