Error during forced Migration v4 -> v5

@ecomsilio can you look directly in the v4 database for the contact with a id of 5.

Hi @david

Does this help?

Yes it does.

So it looks like that contact has been deleted in V4, however there are still references to that contact elsewhere in the system, ie attached to an invitation etc etc.

I’ll need to modify the V4 code as we don’t migrate the deleted contacts at the moment.

I’ll need to migrate the deleted contacts so all the other references are able to be linked back in.

@ecomsilio

I’ve checked in a fix to the master branch of v4, if you can pull in those changes and retry that would be great!.

Thanks for the quick update. I installed IN via curl -L https://download.invoiceninja.com/ -o invoiceninja.zip and not via Github and I normally use the update script that checks the updated version from https://www.invoiceninja.org/

I don’t want to break things and I unsure on how to update using github. Si I will wait for the new release and then try it again.

Thanks,
Gijs

1 Like

Would it break structure if we delete all deleted items from the db directly?

When you do a force update, the old V5 company is deleted so there is no point in manually editting the DB. In fact, we strong recommend not modifying any data directly in the DB.

Hi @david

I have just updated tp v4.5.30 and tried the migration again. The target system had not receicev a migration file ever before so it was the first mirgation for this system.

All clients are available now but I am missing invoices and products. The log contains the following error:

[2021-01-18 00:01:03] production.INFO: latest version = 5.0.47  
[2021-01-18 00:01:03] production.INFO: updating currencies  
[2021-01-18 11:47:08] production.INFO: Importing account  
[2021-01-18 11:47:08] production.INFO: Importing company  
[2021-01-18 11:47:08] production.INFO: the path /storage/y33feijmdzo41u51a4dlp61cpphdngfy/vwJ2gSWC8I707Q0x89RWFiI5tmtfgfo5rfiMKKsB.png  
[2021-01-18 11:47:08] production.INFO: Importing users  
[2021-01-18 11:47:08] production.INFO: Importing payment_terms  
[2021-01-18 11:47:08] production.INFO: Importing tax_rates  
[2021-01-18 11:47:08] production.INFO: Importing clients  
[2021-01-18 11:47:09] production.INFO: Importing company_gateways  
[2021-01-18 11:47:09] production.INFO: Importing client_gateway_tokens  
[2021-01-18 11:47:09] production.INFO: Importing vendors  
[2021-01-18 11:47:09] production.INFO: Importing projects  
[2021-01-18 11:47:09] production.INFO: Importing products  
[2021-01-18 11:47:09] production.INFO: Importing credits  
[2021-01-18 11:47:09] production.INFO: Importing invoices  
[2021-01-18 11:47:09] production.INFO: client_contacts  
[2021-01-18 11:47:09] production.INFO: Resource client_contacts not available.  
[2021-01-18 11:47:10] production.ERROR: Resource client_contacts not available. {"userId":1,"exception":"[object] (Exception(code: 0): Resource client_contacts not available. at /var/www/invoiceninja/app/Jobs/Util/Import.php:1320)
[stacktrace]
#0 /var/www/invoiceninja/app/Jobs/Util/Import.php(701): App\\Jobs\\Util\\Import->transformId()
#1 /var/www/invoiceninja/app/Jobs/Util/Import.php(202): App\\Jobs\\Util\\Import->processInvoices()
#2 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\Import->handle()
#3 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#4 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#5 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#6 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#7 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#8 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#9 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#10 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#11 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(67): Illuminate\\Bus\\Dispatcher->dispatchNow()
#12 /var/www/invoiceninja/app/Jobs/Util/StartMigration.php(111): App\\Jobs\\Util\\Import::dispatchNow()
#13 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\StartMigration->handle()
#14 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#15 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#16 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#17 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#18 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#19 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#20 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#22 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118): Illuminate\\Bus\\Dispatcher->dispatchNow()
#23 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#24 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#25 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\\Pipeline\\Pipeline->then()
#26 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#27 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#28 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\\Queue\\Jobs\\Job->fire()
#29 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\\Queue\\Worker->process()
#30 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\\Queue\\Worker->runJob()
#31 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\\Queue\\Worker->daemon()
#32 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#33 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#34 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#35 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#36 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#37 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\\Container\\BoundMethod::call()
#38 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#39 /var/www/invoiceninja/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute()
#40 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#41 /var/www/invoiceninja/vendor/symfony/console/Application.php(971): Illuminate\\Console\\Command->run()
#42 /var/www/invoiceninja/vendor/symfony/console/Application.php(290): Symfony\\Component\\Console\\Application->doRunCommand()
#43 /var/www/invoiceninja/vendor/symfony/console/Application.php(166): Symfony\\Component\\Console\\Application->doRun()
#44 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#45 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#46 /var/www/invoiceninja/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#47 {main}
"} 

Any idea what to do? I you need more information, please let me know. If you want, we can also send you a sql dump or we can use screensharing.

Thanks,
Gijs

All we did was delete the deleted invoices, contacts, quotes, and payments from the old v4 prior to migrating. I can however revert back to where all the deleted items are there as 4.30 fixed that. Do you recommend reverting back?

@rpbx

You could potentially wipe out a bunch of foreign key dependencies doing this so we strong recommend not touching the DB. I would suggest rolling back any manual DB changed.

Hey @ecomsilio, seems we are doing the same steps at the same time :slight_smile: So, same here with latest versions for V4 and V5 (V5 a new fresh one installation)

production.ERROR: Resource client_contacts not available.

Hi Ubi,

David has received a sql dump of my database and will look into it. I guess we have a general solution soon.

Cheers,
Gijs

1 Like