We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I check for table existence on postgreSQL database, the builder query with the following statement:
select * from information_schema.tables where table_name = ?
Therefore, return as the table is existing if it is existed even in other schema. The better statement might be
select * from information_schema.tables where table_name = ? AND table_schema = ?
and pass the schema name as the second parameter.
The text was updated successfully, but these errors were encountered:
Here's the 'Quick-fixes' I put into the code:
File: Illuminate\Database\Schema\Builder.php
Illuminate\Database\Schema\Builder.php
public function hasTable($table) { $sql = $this->grammar->compileTableExists(); $table = $this->connection->getTablePrefix().$table; $schema = $this->connection->getConfig('schema'); // <-- add this line return count($this->connection->select($sql, [$table, $schema])) > 0; // <-- add $schema in to the array parameter }
File: Illuminate\Database\Schema\Grammars\PostgresGrammar.php
Illuminate\Database\Schema\Grammars\PostgresGrammar.php
public function compileTableExists() { return 'select * from information_schema.tables where table_name = ? and table_schema = ?'; // <-- add 'and table_schema = ?' }
Sorry, something went wrong.
@GrahamCampbell this one was fixed here #13008
Thanks. ;)
No branches or pull requests
When I check for table existence on postgreSQL database, the builder query with the following statement:
Therefore, return as the table is existing if it is existed even in other schema. The better statement might be
and pass the schema name as the second parameter.
The text was updated successfully, but these errors were encountered: