Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.04k stars 885 forks source link

[Bug] CRUD::setFromDb() : Unknown database type ltree requested, Doctrine\DBAL\Platforms\PostgreSQL100Platform may not support it. #5438

Closed Astriel closed 1 month ago

Astriel commented 6 months ago

Bug report

What I did

I've integrated Laravel Bakcpack + Pro + Devtools on my current Laravel project. I'm using Pgsql 14.10 and a ltree type of field. I've generated my CRUDS with the DevTools, but I can't access any of them because the ltree field is not recognized by Backpack.

What I expected to happen

Being able to see a ListOperationCrud avec the generation of the CRUD through Devtools.

What happened

` /**

 * Define what happens when the List operation is loaded.

 *

 * @see  https://backpackforlaravel.com/docs/crud-operation-list-entries

 * @return void

 */

protected function setupListOperation()

{

    CRUD::setFromDb(); // set columns from db columns.

    /**

     * Columns can be defined using the fluent syntax:

     * - CRUD::column('price')->type('number');

     */

}`

Unknown database type ltree requested, Doctrine\DBAL\Platforms\PostgreSQL100Platform may not support it.

What I've already tried to fix it

To include this package : https://github.com/tpetry/laravel-postgresql-enhanced but still not working because I think it comes from the setFromDb(); method which is not supposed to crash like this.

Is it a bug in the latest version of Backpack?

Yes.

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP 8.1.10 (cli) (built: Aug 30 2022 18:05:49) (ZTS Visual C++ 2019 x64) Copyright (c) The PHP Group Zend Engine v4.1.10, Copyright (c) Zend Technologies

LARAVEL VERSION:

10.43.0.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.2.2 backpack/crud: 6.6.1 backpack/devtools: 3.0.4 backpack/generators: v4.0.3 backpack/language-switcher: 2.0.0 backpack/logmanager: v5.0.1 backpack/pro: 2.1.2 backpack/theme-coreuiv4: 1.1.1

jcastroa87 commented 6 months ago

Hi @Astriel

Since ltree is not a native field type in SQL this is not a bug, it is simply not supported by having to use it through an extension. In any case, I will keep the topic open for a period to see if anyone else requires this new feature to be developed or if you find an alternative before you can share it with the community.

Cheers.

pxpm commented 1 month ago

Closing due to inactivity.

setFromDB() shouldn't be trusted to setup your columns.

Next version of Backpack won't have setFromDB on the files it creates I hope 🙏

Cheers