V4 migration to V5

V5 with a fresh install is good but after migration above errors start appearing and we cannot login to it. Please help.

@david and @hillel , any word on this please ? This has been more than a week since I have been troubleshooting this new V5 release. Your help is highly appreciated

Hey @fayaz,

I am not able to reproduce this. Is a Docker option for you? Could you try that? Thanks.

@fayaz sorry for the delay, I just cannot recreate this which makes it hard to provide a solution.

One question I have is this: in the V5 logs after the migration has completed, there should be a list of imported objects like this:

[2020-12-06 20:40:08] development.INFO: Importing company  
[2020-12-06 20:40:08] development.INFO: Importing users  
[2020-12-06 20:40:08] development.INFO: Importing payment_terms  
[2020-12-06 20:40:08] development.INFO: Importing tax_rates  
[2020-12-06 20:40:08] development.INFO: Importing clients  
[2020-12-06 20:40:10] development.INFO: Importing company  
[2020-12-06 20:40:10] development.INFO: Importing users  
[2020-12-06 20:40:10] development.INFO: Importing payment_terms  
[2020-12-06 20:40:10] development.INFO: Importing tax_rates  
[2020-12-06 20:40:10] development.INFO: Importing clients  
[2020-12-06 20:40:10] development.INFO: Importing vendors  
[2020-12-06 20:40:10] development.INFO: Importing projects  
[2020-12-06 20:40:10] development.INFO: Importing products  
[2020-12-06 20:40:10] development.INFO: Importing credits  
[2020-12-06 20:40:10] development.INFO: Importing invoices  
[2020-12-06 20:40:10] development.INFO: Importing recurring_invoices  
[2020-12-06 20:40:10] development.INFO: Importing quotes  
[2020-12-06 20:40:10] development.INFO: Importing payments  
[2020-12-06 20:40:10] development.INFO: Importing company_gateways  
[2020-12-06 20:40:10] development.INFO: Importing client_gateway_tokens  
[2020-12-06 20:40:10] development.INFO: Importing expense_categories  
[2020-12-06 20:40:10] development.INFO: Importing task_statuses  
[2020-12-06 20:40:10] development.INFO: Importing expenses  
[2020-12-06 20:40:10] development.INFO: Importing tasks  
[2020-12-06 20:40:11] development.INFO: Completed🚀🚀🚀🚀🚀 at 2020-12-06 20:40:11 

can you please cut and paste these as it will help determine where the migration is failing.

@david
Nothing like above logs is showing at our end. We observed that you have released new version (5.0.34) and we have updated our app to this latest one thinking that it may solve the issue but after this update now there is an other error below

Error: Make sure you did proper setup with V5 of Invoice Ninja, before starting migration.

We have already V5 up and running with latest but migration from v4 is giving above error

Below are V5 error logs

#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(87): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#27 /var/www/html/vendor/sentry/sentry-laravel/src/Sentry/Laravel/Tracing/Middleware.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Sentry\Laravel\Tracing\Middleware->handle()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#32 /var/www/html/public/index.php(57): Illuminate\Foundation\Http\Kernel->handle()
#33 {main}
"}

This has been around two weeks since i have been troubleshooting and we really need to migrate to the v5 version please. Is there a way that we can send you our v5 login credentials privately so that you can take at it for us please?

This specific error indicates either:

  1. You haven’t setup an identical user in V5 as V4 (email and passwords must match between the two systems).
  2. The V5 URL you are entering into as the migration URL is incorrect.

Its important to note that V5 is not considered Stable yet, so it shouldn’t be used for production so there shouldn’t be a rush to jump into it yet. It is only suitable for testing purposes.

Both of these are correct , it was good till version 5.0.31 but upgrading to .34 is having this issue. Would you pls take a look at our V5 setup once ?

Hey there, can you please remove:

API_SECRET

from .env file of Invoice Ninja v5 and see if that works for you.

Also, don’t forget to run: php artisan optimize after changing the .env file.

Finally after lot troubleshooting , at least i can see the migrated data into V5(5.0.34) which is good sign but migration logs are showing some errors given below

[2020-12-10 14:44:17] production.INFO: Importing company
[2020-12-10 14:44:17] production.INFO: Importing users
[2020-12-10 14:44:17] production.INFO: Importing payment_terms
[2020-12-10 14:44:17] production.INFO: Importing tax_rates
[2020-12-10 14:44:17] production.INFO: Importing clients
[2020-12-10 14:44:22] production.INFO: Importing vendors
[2020-12-10 14:44:22] production.INFO: Importing projects
[2020-12-10 14:44:22] production.INFO: Importing products
[2020-12-10 14:44:22] production.INFO: Importing credits
[2020-12-10 14:44:22] production.INFO: Importing invoices
[2020-12-10 14:44:30] production.INFO: Importing recurring_invoices
[2020-12-10 14:44:30] production.INFO: Importing quotes
[2020-12-10 14:44:30] production.INFO: Importing payments
[2020-12-10 14:44:33] production.INFO: Importing company_gateways
[2020-12-10 14:44:33] production.INFO: Importing client_gateway_tokens
[2020-12-10 14:44:33] production.INFO: Importing expense_categories
[2020-12-10 14:44:33] production.INFO: Importing task_statuses
[2020-12-10 14:44:33] production.INFO: in task statuses
[2020-12-10 14:44:33] production.INFO: finished task statuses
[2020-12-10 14:44:33] production.INFO: Importing expenses
[2020-12-10 14:44:33] production.INFO: Importing tasks
[2020-12-10 14:44:34] production.INFO: Mailer [mail] is not defined.
[2020-12-10 14:44:34] production.ERROR: Mailer [mail] is not defined. {“userId”:1,“exception”:"[object] (InvalidArgumentException(code: 0): Mailer [mail] is not defined. at /var/www/html/ninja5/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php:110)
[stacktrace]

[2020-12-10 14:44:34] production.INFO: Importing company
[2020-12-10 14:44:35] production.INFO: Importing users
[2020-12-10 14:44:35] production.INFO: Importing payment_terms
[2020-12-10 14:44:35] production.INFO: Importing tax_rates
[2020-12-10 14:44:35] production.INFO: Importing clients
[2020-12-10 14:44:43] production.INFO: Importing vendors
[2020-12-10 14:44:43] production.INFO: Importing projects
[2020-12-10 14:44:43] production.INFO: Importing products
[2020-12-10 14:44:43] production.INFO: Importing credits
[2020-12-10 14:44:43] production.INFO: Importing invoices
[2020-12-10 14:44:55] production.INFO: Importing recurring_invoices
[2020-12-10 14:44:55] production.INFO: Importing quotes
[2020-12-10 14:44:56] production.INFO: Importing payments
[2020-12-10 14:45:03] production.INFO: payment with no status id?
[2020-12-10 14:45:03] production.INFO: Array
(
[client_id] => 216
[user_id] => 13
[company_id] => 6
[is_deleted] => 0
[amount] => 135.00
[applied] => 0
[refunded] => 0
[date] =>
[created_at] => 2020-07-15
[updated_at] => 2020-07-15
[deleted_at] =>
)

[2020-12-10 14:45:03] production.INFO: Undefined index: status_id
[2020-12-10 14:45:03] production.ERROR: Undefined index: status_id {“userId”:1,“exception”:"[object] (ErrorException(code: 0): Undefined index: status_id at /var/www/html/ninja5/app/Repositories/Migration/PaymentMigrationRepository.php:94)
[stacktrace]

in your .env file what is the value for

MAIL_MAILER

This should be something like smtp log etcetc, by the looks of that error, it may have the value mail which is incorrect.

Okay, MAIL_MAILER was set to mail which i have now changed to smtp .
MAIL_MAILER=smtp

Though this mail error appeared in logs but i can see the migrated data in V5 now , do you think this error may still have caused some data migration issues or its okay and we can ignore this error during migration ?

Also, What if i would like to start the same migration again ? Would the existing data on V5 would be replaced/overwritten with new one or it will cause the duplication of data ?

@fayaz you can remigrate your data, in V4, there is an open to “FORCE” this will dump the old company and recreate it with the data from V4… If you don’t select FORCE the migration will not proceed.

After you have migrated your data i would suggest running the check data script

php artisan ninja:check

This will check that your balances are correct. It is also recommend to carefully check your data manually. So far the migration is very stable, but there are still small issues we are ironing out.

Hi @david and @ben

I have upgrade to your latest stable version V5.1.19 and now i am trying to migrate data from V4 to it but migration is not working and i am seeing below logs in V5

[2021-03-10 21:41:02] production.INFO: Resource account is not available for migration.
[2021-03-10 21:41:02] production.INFO: Importing company
[2021-03-10 21:41:02] production.INFO: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘logo’ in ‘field list’ (SQL: update companies set ip = 174.112.243.8, company_key = lho4ufniyag3iloggfure3ocy16cwcyp, update_products = 0, show_product_details = 0, enable_modules = 15, custom_fields = {“product1”:

=============================

And when i go to V5 Dashboard to check if still any company has migrated but instead of actual company names it shows something like New company , New Company as attached in screenshot and there is no any data

Can you please help so that we can complete our migration? Thanks ninjav5

It sounds like you are migrating from an old version of V4? You will need to update to the latest

Thanks @david , I will try that.

Also, Can we use invoice templates of V4 to V5 ? If yes then what’s the best way to migrate these as well pls?

Also, We have 5 companies so just wanted to see If there is a way in V5 for the sub-users to switch between all 5 like admin ?

Thankyou

Hi,

The designs are completely different so can’t be brought over, in v5 we use HTM/CSS so they should be much easier to design.

In v5 all users can switch between the companies they belong to. To enable this for migrated v4 users you’ll need to merge the user records between the company. Rather than have user1 at company1 and user2 at company2 you would have user at company1 and company2.

Thanks for quick response. We will try above and let you know incase of any questions. Thankyou

Hi @david @hillel
i have upgraded V4 version to the latest and then tried migration to V5 again and getting below error in the logs now

[2021-03-11 11:25:27] production.INFO: Importing account
[2021-03-11 11:25:27] production.INFO: Importing company
[2021-03-11 11:25:28] production.INFO: Importing users
[2021-03-11 11:25:28] production.INFO: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘has_password’ in ‘field list’ (SQL: update users set confirmation_code = VolejRejNm-2QEfDQYHVQiw9VcMKpPJFergZiWcpmi6lEkKXVGJ3cbyL67ROeJ9rlXTqtF911V4, remember_token = R6iFguJz3CRgeq56WhpVUSHtssJ28l1QTufXY6PvSLxNo3cU52wbuAVr2suA, has_password = 1, users.updated_at = 2020-11-25 00:00:00.000000 where id = 1)

Please help

It looks like you have upgraded your V5, but not run the migrations.

you need to run php artisan migrate in your V5 installation.

Just run the migration as above

php artisan migrate


  • Application In Production!     *
    

Do you really wish to run this command? (yes/no) [no]:

yes

Nothing to migrate.

But migration is still not working. All i see in my V5 as shown in picture