jjdejong / phpip

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

pb when running php artisan migrate #69

Closed alexandreIP closed 3 years ago

alexandreIP commented 3 years ago

Happy new year ! I just made un update from last tim with git pull then with composer install. All went well except unless php artisan migrate (see end of message) The phpip system seems to work.

pi@raspberrypi:/var/www/html/phpipf $ git pull remote: Enumerating objects: 794, done. remote: Counting objects: 100% (794/794), done. remote: Compressing objects: 100% (18/18), done. remote: Total 1870 (delta 777), reused 791 (delta 775), pack-reused 1076 Réception d'objets: 100% (1870/1870), 655.52 KiB | 1.48 MiB/s, fait. Résolution des deltas: 100% (1349/1349), complété avec 115 objets locaux. Depuis https://github.com/jjdejong/phpip 4c682c1..95d6a98 master -> origin/master

pi@raspberrypi:/var/www/html/phpipf $ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Package operations: 18 installs, 85 updates, 6 removals

pi@raspberrypi:/var/www/html/phpipf $ php artisan migrate Migrating: 2020_06_23_200200_remove_parent_filed_deps Migrated: 2020_06_23_200200_remove_parent_filed_deps (3,267.71ms) Migrating: 2020_07_29_190800_fix_insert_recurring_renewals Migrated: 2020_07_29_190800_fix_insert_recurring_renewals (93.59ms) Migrating: 2020_07_30_091000_update_special_countries Migrated: 2020_07_30_091000_update_special_countries (1,529.77ms) Migrating: 2020_09_18_135000_update_tables11 Migrated: 2020_09_18_135000_update_tables11 (6,458.04ms) Migrating: 2020_10_01_130832_update_category_provisional

Illuminate\Database\QueryException

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (phpipf.matter, CONSTRAINT matter_type_code_foreign FOREIGN KEY (type_code) REFERENCES matter_type (code) ON DELETE SET NULL ON UPDATE CASCADE) (SQL: update matter set category_code = PAT, type_code = PRO where category_code = PRO)

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678 674▕ // If an exception occurs when attempting to run a query, we'll format the error 675▕ // message to include the bindings with SQL, which will make this exception a 676▕ // lot more helpful to the developer instead of just the database's errors. 677▕ catch (Exception $e) { ➜ 678▕ throw new QueryException( 679▕ $query, $this->prepareBindings($bindings), $e 680▕ ); 681▕ } 682▕

  +10 vendor frames 

11 database/migrations/2020_10_01_130832_update_category_provisional.php:14 Illuminate\Database\Query\Builder::update(["PAT", "PRO"])

  +21 vendor frames 

33 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) pi@raspberrypi:/var/www/html/phpipf $

jjdejong commented 3 years ago

Yes, the "Provisional" type probably doesn't exist in your matter_type table. That was forgotten. I've updated the "update_category_provisional" migration script. Pull the new code, do a php artisan migrate:rollback and again php artisan migrate.

alexandreIP commented 3 years ago

Perfect, thank you !

pi@raspberrypi:/var/www/html/phpipf $ git pull remote: Enumerating objects: 13, done. remote: Counting objects: 100% (13/13), done. remote: Compressing objects: 100% (2/2), done. remote: Total 7 (delta 5), reused 7 (delta 5), pack-reused 0 Dépaquetage des objets: 100% (7/7), fait. Depuis https://github.com/jjdejong/phpip 95d6a98..6d5336a master -> origin/master Mise à jour 95d6a98..6d5336a Fast-forward database/migrations/2020_10_01_130832_update_category_provisional.php | 1 + database/seeders/MatterTypeTableSeeder.php | 9 +++++++++ 2 files changed, 10 insertions(+) pi@raspberrypi:/var/www/html/phpipf $ composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Package zendframework/zend-escaper is abandoned, you should avoid using it. Use laminas/laminas-escaper instead. Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi Discovered Package: facade/ignition Discovered Package: fideloper/proxy Discovered Package: fruitcake/laravel-cors Discovered Package: laravel/tinker Discovered Package: laravel/ui Discovered Package: nesbot/carbon Discovered Package: nunomaduro/collision Package manifest generated successfully. pi@raspberrypi:/var/www/html/phpipf $ php artisan migrate:rollback Rolling back: 2020_09_18_135000_update_tables11 Rolled back: 2020_09_18_135000_update_tables11 (5,345.99ms) Rolling back: 2020_07_30_091000_update_special_countries Rolled back: 2020_07_30_091000_update_special_countries (0.17ms) Rolling back: 2020_07_29_190800_fix_insert_recurring_renewals Rolled back: 2020_07_29_190800_fix_insert_recurring_renewals (0.16ms) Rolling back: 2020_06_23_200200_remove_parent_filed_deps Rolled back: 2020_06_23_200200_remove_parent_filed_deps (0.17ms) pi@raspberrypi:/var/www/html/phpipf $ php artisan migrate Migrating: 2020_06_23_200200_remove_parent_filed_deps Migrated: 2020_06_23_200200_remove_parent_filed_deps (3,582.86ms) Migrating: 2020_07_29_190800_fix_insert_recurring_renewals Migrated: 2020_07_29_190800_fix_insert_recurring_renewals (78.11ms) Migrating: 2020_07_30_091000_update_special_countries Migrated: 2020_07_30_091000_update_special_countries (91.19ms) Migrating: 2020_09_18_135000_update_tables11 Migrated: 2020_09_18_135000_update_tables11 (9,140.20ms) Migrating: 2020_10_01_130832_update_category_provisional Migrated: 2020_10_01_130832_update_category_provisional (309.41ms) Migrating: 2020_12_04_133640_update_matter_alt_ref Migrated: 2020_12_04_133640_update_matter_alt_ref (2,751.31ms) pi@raspberrypi:/var/www/html/phpipf $