Created Invoices not sent out after update to 3.6.1

Hi

When I try to send out an invoice that was just created, I get the following error:

[2017-09-06 14:13:00] production.ERROR: ErrorException [0] : /var/www/ninja/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 729] => SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘is_default’ in ‘where clause’ (SQL: select * from documents where documents.account_id = 1 and documents.account_id is not null and is_default = 1) (View: /var/www/ninja/resources/views/invoices/view.blade.php) {“context”:“PHP”,“user_id”:0,“account_id”:0,“user_name”:"",“method”:“GET”,“url”:“https://test.domain.com/view/nyu18gobjanzjr2rm9kf5avewswsg6wt",“previous”:“https://test.domain.com”,“user_agent”:"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) Safari/534.34 PhantomJS/2.0.0 (PhantomJsCloud.com/2.0.1)”,“ip”:“35.189.242.78”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

[2017-09-06 14:13:02] production.ERROR: Illuminate\Database\QueryException [42S22] : /var/www/ninja/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 729] => SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘is_default’ in ‘where clause’ (SQL: select * from documents where documents.account_id = 1 and documents.account_id is not null and is_default = 1) {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“Sandro Bolliger”,“method”:“PUT”,“url”:“https://test.domain.com/invoices/116",“previous”:“https://test.domain.com/invoices/116/edit”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”,“ip”:“x.x.x.x”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

[2017-09-06 14:13:02] production.ERROR: Illuminate\Database\QueryException [42S22] : /var/www/ninja/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 729] => SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘is_default’ in ‘where clause’ (SQL: select * from documents where documents.account_id = 1 and documents.account_id is not null and is_default = 1) {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“Sandro Bolliger”,“method”:“PUT”,“url”:“https://test.domain.com/invoices/116",“previous”:“https://test.domain.com/invoices/116/edit”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”,“ip”:“x.x.x.x”,“count”:2,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

[2017-09-06 14:14:06] production.ERROR: ErrorException [0] : /var/www/ninja/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 729] => SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘is_default’ in ‘where clause’ (SQL: select * from documents where documents.account_id = 1 and documents.account_id is not null and is_default = 1) (View: /var/www/ninja/resources/views/invoices/view.blade.php) {“context”:“PHP”,“user_id”:0,“account_id”:0,“user_name”:"",“method”:“GET”,“url”:“https://test.domain.com/view/t8sneidszcvwtchoch1ltkkmfo7xgih9",“previous”:“https://test.domain.com”,“user_agent”:"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) Safari/534.34 PhantomJS/2.0.0 (PhantomJsCloud.com/2.0.1)”,“ip”:“35.195.237.13”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

[2017-09-06 14:14:07] production.ERROR: Illuminate\Database\QueryException [42S22] : /var/www/ninja/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 729] => SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘is_default’ in ‘where clause’ (SQL: select * from documents where documents.account_id = 1 and documents.account_id is not null and is_default = 1) {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“Sandro Bolliger”,“method”:“POST”,“url”:“https://test.domain.com/invoices",“previous”:“https://test.domain.com/invoices/create”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”,“ip”:“x.x.x.x”,“count”:3,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

[2017-09-06 14:14:07] production.ERROR: Illuminate\Database\QueryException [42S22] : /var/www/ninja/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 729] => SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘is_default’ in ‘where clause’ (SQL: select * from documents where documents.account_id = 1 and documents.account_id is not null and is_default = 1) {“context”:“PHP”,“user_id”:1,“account_id”:1,“user_name”:“Sandro Bolliger”,“method”:“POST”,“url”:“https://test.domain.com/invoices",“previous”:“https://test.domain.com/invoices/create”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”,“ip”:“x.x.x.x”,“count”:4,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

[2017-09-06 14:15:02] production.ERROR: Illuminate\Database\QueryException [42S22] : /var/www/ninja/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 729] => SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘late_fee1_amount’ in ‘where clause’ (SQL: select * from accounts where exists (select * from account_email_settings where account_email_settings.account_id = accounts.id and (late_fee1_amount > 0 or late_fee1_percent > 0 or late_fee2_amount > 0 or late_fee2_percent > 0 or late_fee3_amount > 0 or late_fee3_percent > 0)) and accounts.deleted_at is null) {“context”:“PHP”,“user_id”:0,“account_id”:0,“user_name”:"",“method”:“GET”,“url”:“https://test.domain.com”,“previous”:“https://test.domain.com”,“user_agent”:"",“ip”:“127.0.0.1”,“count”:1,“is_console”:“yes”,“is_api”:“no”,“db_server”:“mysql”} []

Thanks for your help
Sandro

It looks like a database migration didn’t run/complete.

What do you see when you load /update (or /public/update) in your browser?

/update did not help. When I do it I see again the log in page with the note what is new in 3.6.1 but when I want to send an invoice the exactly same issue occurs

Are there any errors in storage/logs/laravel-error.log before the “Column not found” errors

Here I have added the complete log: https://ufile.io/hi126

What results do you see from this SQL query:

select * from migrations order by migration desc limit 10;

Do you have command line access?

Yes I have command line access

Database changed
MariaDB [ninjadb]> select * from migrations order by migration desc limit 10;
±------------------------------------------------±------+
| migration | batch |
±------------------------------------------------±------+
| 2017_06_19_111515_update_dark_mode | 1 |
| 2017_05_16_101715_add_default_note_to_client | 1 |
| 2017_05_10_144928_add_oauth_to_lookups | 1 |
| 2017_04_30_174702_add_multiple_database_support | 1 |
| 2017_04_16_101744_add_custom_contact_fields | 1 |
| 2017_03_16_085702_add_gateway_fee_location | 1 |
| 2017_02_23_095934_add_custom_product_fields | 1 |
| 2017_01_01_214241_add_inclusive_taxes | 1 |
| 2016_12_13_113955_add_pro_plan_discount | 1 |
| 2016_11_28_092904_add_task_projects | 1 |
±------------------------------------------------±------+
10 rows in set (0.00 sec)

It looks like the latest migration hasn’t been run, try running:

php artisan migrate php artisan db:seed --class=UpdateSeeder

Here the output:

sandro@bill ninja php artisan migrate


  • Application In Production!     *
    

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

Nothing to migrate.
sandro@bill ninja php artisan db:seed --class=UpdateSeeder


  • Application In Production!     *
    

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

Running UpdateSeeder…
Seeded: CountriesSeeder
Seeded: PaymentLibrariesSeeder
Seeded: FontsSeeder
Seeded: GatewayTypesSeeder
Seeded: BanksSeeder
Seeded: InvoiceStatusSeeder
Seeded: PaymentStatusSeeder
Seeded: CurrenciesSeeder
Seeded: DateFormatsSeeder
Seeded: InvoiceDesignsSeeder
Seeded: PaymentTermsSeeder
Seeded: PaymentTypesSeeder
Seeded: LanguageSeeder
Seeded: IndustrySeeder
Seeded: FrequencySeeder
Seeded: DbServerSeeder

Can you compare your database/migrations folder to this:

https://github.com/invoiceninja/invoiceninja/tree/master/database/migrations

Do you have 2017_07_18_124150_add_late_fees.php

2017_06_19_111515_update_dark_mode.php seems to be the lates one. add_late_fees is missing

When upgrading I assume you copied over the files, not sure why this one would be missing?

Hi Hillel

I have copied over all the files again. Looks like there went something wrong first time I did it… It is working now. Thank you for your help findind this

Great to hear, thanks for letting us know!