You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doesn't work when the project works with multiple schemas.
Only works when you want to retrieve a table of primary schema defined.
Steps To Reproduce:
By default postgresql should have the primary schema public.
Create another schema warehouse.
The .env must define to use public schema as default:
DB_DATABASE=postgres
DB_SCHEMA=public
Create a new migration that creates a new table on warehouse schema:
public function up()
{
Schema::create('warehouse.products', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
Run the migration.
Create this example test:
public function testBasicTest()
{
$columns = [
'id',
'name',
'created_at',
'updated_at',
];
$this->assertEquals($columns, $this->getConnection()->getSchemaBuilder()->getColumnListing('warehouse.products'));
}
I believe this is the same issue I'm running into, with MySQL:
The new updates where Laravel is (I believe) using this function to determine what columns can be filled (Post 7.24) breaks when using Hyn Multi-tenancy, in this case, my model has a custom getTable() which returns system.roles instead of roles as the table name, and as long as this is the case, it won't fill any columns like "name" even though we have set $guarded = ['id']; set on the model
@FreekVR I am not using any model. The problem is precisely that I'm passing this value you said as a parameter directly and it's not working.
$this->getConnection()->getSchemaBuilder()->getColumnListing('warehouse.products'); // not working
$this->getConnection()->getSchemaBuilder()->getColumnListing('products'); // not working
$this->getConnection()->getSchemaBuilder()->getColumnListing('public.users'); // not working
$this->getConnection()->getSchemaBuilder()->getColumnListing('users'); // working
Description:
The way of getting all columns of a table:
Doesn't work when the project works with multiple schemas.
Only works when you want to retrieve a table of primary schema defined.
Steps To Reproduce:
By default postgresql should have the primary schema
public
.Create another schema
warehouse
.The .env must define to use
public
schema as default:Create a new migration that creates a new table on
warehouse
schema:Run the migration.
Create this example test:
Expected result
The test should pass.
Actual result
The test fails.
This line:
returns
[]
The text was updated successfully, but these errors were encountered: