Skip to content

Commit

Permalink
Fix Sqlite schema/attach support
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jul 17, 2022
1 parent 39a05f6 commit 015bc79
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey)
{
return parent::getForeignKeyDeclarationSQL(new ForeignKeyConstraint(
$foreignKey->getQuotedLocalColumns($this),
str_replace('.', '__', $foreignKey->getQuotedForeignTableName($this)),
$foreignKey->getQuotedForeignTableName($this),
$foreignKey->getQuotedForeignColumns($this),
$foreignKey->getName(),
$foreignKey->getOptions()
Expand All @@ -347,7 +347,6 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey)
*/
protected function _getCreateTableSQL($name, array $columns, array $options = [])
{
$name = str_replace('.', '__', $name);
$queryFields = $this->getColumnDeclarationListSQL($columns);

if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
Expand Down Expand Up @@ -461,8 +460,6 @@ public function getClobTypeDeclarationSQL(array $column)
*/
public function getListTableConstraintsSQL($table)
{
$table = str_replace('.', '__', $table);

return sprintf(
"SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = %s AND sql NOT NULL ORDER BY name",
$this->quoteStringLiteral($table)
Expand All @@ -474,8 +471,6 @@ public function getListTableConstraintsSQL($table)
*/
public function getListTableColumnsSQL($table, $database = null)
{
$table = str_replace('.', '__', $table);

return sprintf('PRAGMA table_info(%s)', $this->quoteStringLiteral($table));
}

Expand All @@ -484,8 +479,6 @@ public function getListTableColumnsSQL($table, $database = null)
*/
public function getListTableIndexesSQL($table, $database = null)
{
$table = str_replace('.', '__', $table);

return sprintf('PRAGMA index_list(%s)', $this->quoteStringLiteral($table));
}

Expand Down Expand Up @@ -586,7 +579,7 @@ public function getName()
public function getTruncateTableSQL($tableName, $cascade = false)
{
$tableIdentifier = new Identifier($tableName);
$tableName = str_replace('.', '__', $tableIdentifier->getQuotedName($this));
$tableName = $tableIdentifier->getQuotedName($this);

return 'DELETE FROM ' . $tableName;
}
Expand Down Expand Up @@ -792,8 +785,6 @@ public function getBlobTypeDeclarationSQL(array $column)
*/
public function getTemporaryTableName($tableName)
{
$tableName = str_replace('.', '__', $tableName);

return $tableName;
}

Expand Down Expand Up @@ -881,8 +872,6 @@ public function getCreateTableSQL(Table $table, $createFlags = null)
*/
public function getListTableForeignKeysSQL($table, $database = null)
{
$table = str_replace('.', '__', $table);

return sprintf('PRAGMA foreign_key_list(%s)', $this->quoteStringLiteral($table));
}

Expand Down

0 comments on commit 015bc79

Please sign in to comment.