Skip to content

Commit 1cdace4

Browse files
authored
[10.x] Combine prefix with table for compileDropPrimary PostgreSQL (#48268)
* Combine prefix with table * StyleCI fix
1 parent f767da1 commit 1cdace4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Illuminate/Database/Schema/Blueprint.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,16 @@ public function getTable()
17851785
return $this->table;
17861786
}
17871787

1788+
/**
1789+
* Get the table prefix.
1790+
*
1791+
* @return string
1792+
*/
1793+
public function getPrefix()
1794+
{
1795+
return $this->prefix;
1796+
}
1797+
17881798
/**
17891799
* Get the columns on the blueprint.
17901800
*

src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public function compileDropColumn(Blueprint $blueprint, Fluent $command)
427427
*/
428428
public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
429429
{
430-
$index = $this->wrap("{$blueprint->getTable()}_pkey");
430+
$index = $this->wrap("{$blueprint->getPrefix()}{$blueprint->getTable()}_pkey");
431431

432432
return 'alter table '.$this->wrapTable($blueprint)." drop constraint {$index}";
433433
}

0 commit comments

Comments
 (0)