Skip to content

Commit

Permalink
[10.x] Combine prefix with table for compileDropPrimary PostgreSQL (#…
Browse files Browse the repository at this point in the history
…48268)

* Combine prefix with table

* StyleCI fix
  • Loading branch information
dyriavin committed Sep 1, 2023
1 parent f767da1 commit 1cdace4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Illuminate/Database/Schema/Blueprint.php
Expand Up @@ -1785,6 +1785,16 @@ public function getTable()
return $this->table;
}

/**
* Get the table prefix.
*
* @return string
*/
public function getPrefix()
{
return $this->prefix;
}

/**
* Get the columns on the blueprint.
*
Expand Down
Expand Up @@ -427,7 +427,7 @@ public function compileDropColumn(Blueprint $blueprint, Fluent $command)
*/
public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
{
$index = $this->wrap("{$blueprint->getTable()}_pkey");
$index = $this->wrap("{$blueprint->getPrefix()}{$blueprint->getTable()}_pkey");

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

0 comments on commit 1cdace4

Please sign in to comment.