Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stormy478's avatar

There is no column with name "product_owner" on table "products". error

I'm trying to get a column type of a specific table and column, the problem I'm having is that when I get to the line of code I get this error

 There is no column with name "product_owner" on table "products".

The thing is, is that there is a product_owner in the products table.

Here is my code


foreach(Schema::getColumnListing('products') as $fields)
{
	$columnType = Schema::getColumnType('products', $fields);
	dd($columnType);
}
0 likes
10 replies
stormy478's avatar

@jlrdw there is no relationship. product_owner is a string field in the products table

Snapey's avatar

connected to the right database?

change your dd to dump, run the script then paste the result here

stormy478's avatar

@Snapey yes it is and this is what i get when I dump

   Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist 

  There is no column with name "product_owner" on table "products".

  at vendor/doctrine/dbal/src/Schema/Exception/ColumnDoesNotExist.php:16
     12▕ final class ColumnDoesNotExist extends SchemaException
     13▕ {
     14▕     public static function new(string $columnName, string $table): self
     15▕     {
  ➜  16▕         return new self(
     17▕             sprintf('There is no column with name "%s" on table "%s".', $columnName, $table),
     18▕             self::COLUMN_DOESNT_EXIST,
     19▕         );
     20▕     }

      +5 vendor frames 
  6   Modules/Products/Models/Product.php:96
      Illuminate\Support\Facades\Facade::__callStatic()

  7   Modules/Products/Console/RefreshProductColumns.php:44
      Modules\Products\Models\Product::refreshColumns()

Snapey's avatar

what does this return ?

dd(Schema::getColumnListing('products') );
stormy478's avatar

@Snapey I get

array:4 [ // Modules/Products/Models/Product.php:86
  0 => "id"
  1 => "product_owner"
  2 => "name"
  3 => "description"
]
stormy478's avatar

@Snapey product_owner is just a simple string that is only gonna have a name to it

Snapey's avatar

What is refreshColumns function ?

Please or to participate in this conversation.