laravel
laravel copied to clipboard
How to change postgres schema?
I have databases in postgres with multi schema and i want change schema to "current" from default "public".
When i run: php artisan code:models
=> model on schema public, but i want creat on schema "current".
Pls help me!
Have you tried php artisan code:models --schema=current
?
I have tried, but it don't work!
I have the same issue.
File: src/Meta/Postgres/Schema.php Missing $schema parameter.
You need to replace 'public' to $this->schema
here
/**
* @param string $schema
*
* @return array
*/
protected function fetchTables()
{
$rows = $this->arraify($this->connection->select(
'SELECT * FROM pg_tables where schemaname=\'public\''
));
$names = array_column($rows, 'tablename');
return Arr::flatten($names);
}
and here
/**
* @param \Reliese\Meta\Blueprint $blueprint
*/
protected function fillColumns(Blueprint $blueprint)
{
$rows = $this->arraify($this->connection->select(
'SELECT * FROM information_schema.columns '.
'WHERE table_schema=\'public\''.
'AND table_name='.$this->wrap($blueprint->table())
));
foreach ($rows as $column) {
$blueprint->withColumn(
$this->parseColumn($column)
);
}
}