Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Get indexes of a table #49204

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor improvements
hafezdivandari committed Dec 1, 2023
commit 1e07fe9fa25a9bbd0d03071a5533d79d1f86db41
8 changes: 4 additions & 4 deletions src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
Original file line number Diff line number Diff line change
@@ -136,11 +136,11 @@ public function compileColumns($table)
public function compileIndexes($table)
{
return sprintf(
'select -1 as seq, "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 seq '
.'union select seq, name, group_concat(col) as columns, "unique", origin = "pk" 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" '
.'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 order by seq',
.'group by name, "unique", "primary"',
$table = $this->wrap(str_replace('.', '__', $table)),
$table
);