package updates
This commit is contained in:
@@ -10,6 +10,30 @@ use Illuminate\Database\Schema\Grammars\SQLiteGrammar as SchemaGrammar;
|
||||
|
||||
class SQLiteConnection extends Connection
|
||||
{
|
||||
/**
|
||||
* Create a new database connection instance.
|
||||
*
|
||||
* @param \PDO|\Closure $pdo
|
||||
* @param string $database
|
||||
* @param string $tablePrefix
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($pdo, $database = '', $tablePrefix = '', array $config = [])
|
||||
{
|
||||
parent::__construct($pdo, $database, $tablePrefix, $config);
|
||||
|
||||
$enableForeignKeyConstraints = $this->getForeignKeyConstraintsConfigurationValue();
|
||||
|
||||
if ($enableForeignKeyConstraints === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enableForeignKeyConstraints
|
||||
? $this->getSchemaBuilder()->enableForeignKeyConstraints()
|
||||
: $this->getSchemaBuilder()->disableForeignKeyConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default query grammar instance.
|
||||
*
|
||||
@@ -63,4 +87,14 @@ class SQLiteConnection extends Connection
|
||||
{
|
||||
return new DoctrineDriver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the database connection foreign key constraints configuration option.
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
protected function getForeignKeyConstraintsConfigurationValue()
|
||||
{
|
||||
return $this->getConfig('foreign_key_constraints');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user