Skip to content

Commit

Permalink
Backport #51615 (#52215)
Browse files Browse the repository at this point in the history
Co-authored-by: Hafez Divandari <[email protected]>
  • Loading branch information
GrahamCampbell and hafezdivandari authored Jul 22, 2024
1 parent 96712ba commit 7692ec4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function compileColumns($table)
return sprintf(
'select name, type, not "notnull" as "nullable", dflt_value as "default", pk as "primary" '
.'from pragma_table_info(%s) order by cid asc',
$this->wrap(str_replace('.', '__', $table))
$this->quoteString(str_replace('.', '__', $table))
);
}

Expand All @@ -136,12 +136,12 @@ public function compileColumns($table)
public function compileIndexes($table)
{
return sprintf(
'select "primary" as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" '
'select \'primary\' as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" '
.'from (select name as col from pragma_table_info(%s) where pk > 0 order by pk, cid) group by name '
.'union select name, group_concat(col) as columns, "unique", origin = "pk" as "primary" '
.'union select name, group_concat(col) as columns, "unique", origin = \'pk\' as "primary" '
.'from (select il.*, ii.name as col from pragma_index_list(%s) il, pragma_index_info(il.name) ii order by il.seq, ii.seqno) '
.'group by name, "unique", "primary"',
$table = $this->wrap(str_replace('.', '__', $table)),
$table = $this->quoteString(str_replace('.', '__', $table)),
$table
);
}
Expand All @@ -159,7 +159,7 @@ public function compileForeignKeys($table)
.'group_concat("to") as foreign_columns, on_update, on_delete '
.'from (select * from pragma_foreign_key_list(%s) order by id desc, seq) '
.'group by id, "table", on_update, on_delete',
$this->wrap(str_replace('.', '__', $table))
$this->quoteString(str_replace('.', '__', $table))
);
}

Expand Down

0 comments on commit 7692ec4

Please sign in to comment.