Ssgt

Laravel one-to-many on postgreSQL stops working

Posted 1 month ago by Ssgt

I'm using a one-to-many relationship in my code. It is working perfectly fine on localhost with:

  • PHP 7.1.x
  • MySQL (version unknown)
  • Laravel latest stable version (did an composer update yesterday)

Now when I boot the exact same code on a container with these specs:

  • PHP 7.3.x
  • PostgreSQL (version unknown)
  • Laravel latest stable version (did an composer update yesterday)

The one-to-many and one-to-one relationship stops working. When I access the relationship, it returns an empty object on postgres but the same code works fine on MySQL.

I checked both databases and both databases have the same data. Both database have been seeded and migrated with the same migrations and seeds. The migrations do have foreign refferences to each other to match the relationships defined in the models.

Do you guys have any idea why the relation stops working on postgreSQL / what can I do to further research this problem? Do I miss plugins to use relations on postgreSQL? Thanks!

Please sign in or create an account to participate in this conversation.