jjdejong / phpip

Patent and other IP rights portfolio manager and docketing system v2
GNU General Public License v3.0
40 stars 17 forks source link

QueryException #117

Closed alexandreIP closed 1 year ago

alexandreIP commented 1 year ago

pi@raspberrypi:/var/www/html/phpip $ sudo php artisan migrate --seed

INFO Preparing database.

Creating migration table .............................................................................................................. 546ms DONE

INFO Running migrations.

2014_10_12_100000_create_password_resets_table ........................................................................................ 307ms DONE 2018_12_07_184310_create_actor_role_table ............................................................................................. 486ms DONE 2018_12_07_184310_create_actor_table ................................................................................................ 1,736ms DONE 2018_12_07_184310_create_classifier_table ........................................................................................... 1,395ms DONE 2018_12_07_184310_create_classifier_type_table ........................................................................................ 566ms DONE 2018_12_07_184310_create_classifier_value_table ....................................................................................... 754ms DONE 2018_12_07_184310_create_country_table ................................................................................................ 408ms DONE 2018_12_07_184310_create_default_actor_table .......................................................................................... 567ms DONE 2018_12_07_184310_create_event_name_table ............................................................................................. 779ms DONE 2018_12_07_184310_create_event_table .................................................................................................. 671ms DONE 2018_12_07_184310_create_matter_actor_lnk_table ..................................................................................... 1,172ms DONE 2018_12_07_184310_create_matter_category_table ........................................................................................ 518ms DONE 2018_12_07_184310_create_matter_table ................................................................................................. 227ms FAIL

Illuminate\Database\QueryException

SQLSTATE[HY000]: General error: 1901 Function or expression 'concat_ws('',concat_ws('-',concat_ws('/',country,origin),type_code),idx)' cannot be used in the GENERATED ALWAYS AS clause of suffix (SQL: alter table matter add unique UID(category_code, caseref, suffix))

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760 756▕ // If an exception occurs when attempting to run a query, we'll format the error 757▕ // message to include the bindings with SQL, which will make this exception a 758▕ // lot more helpful to the developer instead of just the database's errors. 759▕ catch (Exception $e) { ➜ 760▕ throw new QueryException( 761▕ $query, $this->prepareBindings($bindings), $e 762▕ ); 763▕ } 764▕ }

  +12 vendor frames 

13 database/migrations/2018_12_07_184310_create_matter_table.php:15 Illuminate\Support\Facades\Facade::__callStatic()

  +25 vendor frames 

39 artisan:35 Illuminate\Foundation\Console\Kernel::handle()

jjdejong commented 1 year ago

Not a proper bug report. What OS, version of MySQL, etc.? I've seen this happen before with MariaDB databases. phpIP uses quite advanced features of recent versions of MySQL that are not always available, or not used in the same manner, in other database engines.

alexandreIP commented 1 year ago

Raspbian GNU/Linux 11 (bullseye) PHP 8.2.1 (cli) (built: Jan 7 2023 08:34:34) (NTS) Copyright (c) The PHP Group Zend Engine v4.2.1, Copyright (c) Zend Technologies with Zend OPcache v8.2.1, Copyright (c), by Zend Technologies

mysql: Server version: 10.0.28-MariaDB-2+b1 Raspbian testing-staging

Nouveau blocage: pi@raspberrypi:/var/www/phpip $ sudo php artisan migrate --seed

INFO Preparing database.

Creating migration table .............................................................................................................. 260ms DONE

INFO Running migrations.

2014_10_12_100000_create_password_resets_table ........................................................................................ 395ms DONE 2018_12_07_184310_create_actor_role_table ........................................................................................... 1,122ms DONE 2018_12_07_184310_create_actor_table ................................................................................................ 2,674ms DONE 2018_12_07_184310_create_classifier_table ........................................................................................... 2,350ms DONE 2018_12_07_184310_create_classifier_type_table ........................................................................................ 810ms DONE 2018_12_07_184310_create_classifier_value_table ....................................................................................... 915ms DONE 2018_12_07_184310_create_country_table ................................................................................................ 550ms DONE 2018_12_07_184310_create_default_actor_table ....................................................................................... 24,658ms DONE 2018_12_07_184310_create_event_name_table ........................................................................................... 1,135ms DONE 2018_12_07_184310_create_event_table ................................................................................................ 1,560ms DONE 2018_12_07_184310_create_matter_actor_lnk_table ..................................................................................... 1,101ms DONE 2018_12_07_184310_create_matter_category_table ...................................................................................... 1,261ms DONE 2018_12_07_184310_create_matter_table ................................................................................................. 442ms FAIL

Illuminate\Database\QueryException

SQLSTATE[HY000]: General error: 1904 Key/Index cannot be defined on a non-stored computed column (SQL: alter table matter add unique UID(category_code, caseref, suffix))

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:760 756▕ // If an exception occurs when attempting to run a query, we'll format the error 757▕ // message to include the bindings with SQL, which will make this exception a 758▕ // lot more helpful to the developer instead of just the database's errors. 759▕ catch (Exception $e) { ➜ 760▕ throw new QueryException( 761▕ $query, $this->prepareBindings($bindings), $e 762▕ ); 763▕ } 764▕ }

  +12 vendor frames 

13 database/migrations/2018_12_07_184310_create_matter_table.php:15 Illuminate\Support\Facades\Facade::__callStatic()

  +25 vendor frames 

39 artisan:35 Illuminate\Foundation\Console\Kernel::handle()

jjdejong commented 1 year ago

Right, your MariaDB version is way to old. You need 10.2 at least, I think.

jjdejong commented 1 year ago

Moved to #119