Whoops, looks like something went wrong - after upgrading to 3.0.5

I’m getting a “Whoops, looks like something went wrong.” error message after upgrading to 3.0.5.

What has gone wrong?

I am self-hosted, installed using Softaculous.

Try loading /update (or /public/update) in your browser to see if there are any errors.

Also, check storage/logs/laravel-error.log for details about the error.

/public/update is showing:

SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ‘gateway_type_id’ (SQL: alter table payment_types add gateway_type_id int unsigned null)

laravel-error.log is very long and scary and I don’t know what bit of it tells me about the error.

Thanks, that’s helpful. It looks like a database migration failed.

If you want to email the log file to contact@invoiceninja.com I can try to parse it.

You may be able to fix it by commenting out lines 41 to 50 in database/migrations/2016_09_05_150625_create_gateway_types.php and then reloading /update.

Thanks for the log!

Have you moved the app in the past to a new server?

Not as far as I’m aware, although I know my hosting provider was taken over a few months back, so don’t know if they’ve done anything.

In the log I see this error: General error: 1215 Cannot add foreign key constraint, in the past we’ve seen this when the tables are using different storage engines.

Can you run these SQL queries:
show create table clients;
show create table gateway_types;

At the end it should say Engine=…, it’d be helpful to know the storage engines of the tables.

clients: ENGINE=InnoDB
gateway_types: ENGINE=MyISAM

It looks like that’s the problem, you can set all of the tables to InnoDB by running this query.

You’ll also need to comment out the code mentioned above.

SET sql_mode = 'ALLOW_INVALID_DATES';
ALTER TABLE account_gateway_tokens engine=InnoDB;              
ALTER TABLE account_gateways engine=InnoDB;                    
ALTER TABLE account_tokens engine=InnoDB;                      
ALTER TABLE accounts engine=InnoDB;                            
ALTER TABLE activities engine=InnoDB;                          
ALTER TABLE affiliates engine=InnoDB;                          
ALTER TABLE bank_accounts engine=InnoDB;                       
ALTER TABLE bank_subaccounts engine=InnoDB;                    
ALTER TABLE banks engine=InnoDB;                               
ALTER TABLE clients engine=InnoDB;                             
ALTER TABLE contacts engine=InnoDB;                            
ALTER TABLE countries engine=InnoDB;                           
ALTER TABLE credits engine=InnoDB;                             
ALTER TABLE currencies engine=InnoDB;                          
ALTER TABLE date_formats engine=InnoDB;                        
ALTER TABLE datetime_formats engine=InnoDB;                    
ALTER TABLE expenses engine=InnoDB;                            
ALTER TABLE fonts engine=InnoDB;                               
ALTER TABLE frequencies engine=InnoDB;                         
ALTER TABLE gateways engine=InnoDB;                            
ALTER TABLE industries engine=InnoDB;                          
ALTER TABLE invitations engine=InnoDB;                         
ALTER TABLE invoice_designs engine=InnoDB;                     
ALTER TABLE invoice_items engine=InnoDB;                       
ALTER TABLE invoice_statuses engine=InnoDB;                    
ALTER TABLE invoices engine=InnoDB;                            
ALTER TABLE languages engine=InnoDB;                           
ALTER TABLE licenses engine=InnoDB;                            
ALTER TABLE migrations engine=InnoDB;                          
ALTER TABLE password_resets engine=InnoDB;                     
ALTER TABLE payment_libraries engine=InnoDB;                   
ALTER TABLE payment_terms engine=InnoDB;                       
ALTER TABLE payment_types engine=InnoDB;                       
ALTER TABLE payments engine=InnoDB;                            
ALTER TABLE products engine=InnoDB;                            
ALTER TABLE sizes engine=InnoDB;                               
ALTER TABLE subscriptions engine=InnoDB;                       
ALTER TABLE tasks engine=InnoDB;                               
ALTER TABLE tax_rates engine=InnoDB;                           
ALTER TABLE themes engine=InnoDB;                              
ALTER TABLE timezones engine=InnoDB;                           
ALTER TABLE user_accounts engine=InnoDB;                       
ALTER TABLE users engine=InnoDB;                               
ALTER TABLE vendor_contacts engine=InnoDB;                     
ALTER TABLE vendors engine=InnoDB;

OK - that seems to be missing the gateway_types column… does that need to be included?

I’m not sure I understand.

  • Run the SQL above
  • Comment out the lines 41 to 50
  • Load /update

If you haven’t already made a backup you may want to do so.

I’m not sure what you want commenting out - there’s only 46 lines of code in the SQL statement you provided.

Comment out lines 41 to 50 in database/migrations/2016_09_05_150625_create_gateway_types.php

OK, now I’m getting “Whoops, looks like something went wrong.” when going to /public/update

Please email your latest error log and the file you changed.

I emailed the file last night - any updates as I now can’t access InvoiceNinja at all

I don’t see your email, can you please resend it.

I’ve uploaded the file sent, but am still getting the Whoops message when accessing.

Can you please resend your log file.