500 Error log shows Column not found: 1054 Unknown column 'classification' in 'field list'

Hi all

Not sure why but today I cannot create clients, getting this error in the log:

[2023-12-11 12:29:18] production.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘classification’ in ‘field list’ (Connection: mysql, SQL: insert into clients (company_id, user_id, name, website, private_notes, public_notes, balance, paid_to_date, country_id, is_deleted, client_hash, settings, classification, group_settings_id, address1, address2, city, state, postal_code, phone, industry_id, size_id, vat_number, id_number, shipping_address1, shipping_address2, shipping_city, shipping_state, shipping_postal_code, shipping_country_id, custom_value1, custom_value2, custom_value3, custom_value4, routing_id, is_tax_exempt, assigned_user_id, updated_at, created_at) values (1, 1, Goldbirch Ltd, ?, ?, ?, 0, 0, 826, 0, 8uuPzUL3gqK4CEYhmHbWqTpmUv5GGG2pRcsTq1kt, {“entity”:“App\Models\Client”,“industry_id”:“”,“size_id”:“”,“currency_id”:“2”}, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, 2023-12-11 12:29:18.364500, 2023-12-11 12:29:18.364500)) {“userId”:1,“exception”:"[object] (Illuminate\Database\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘classification’ in ‘field list’ (Connection: mysql, SQL: insert into clients (company_id, user_id, name, website, private_notes, public_notes, balance, paid_to_date, country_id, is_deleted, client_hash, settings, classification, group_settings_id, address1, address2, city, state, postal_code, phone, industry_id, size_id, vat_number, id_number, shipping_address1, shipping_address2, shipping_city, shipping_state, shipping_postal_code, shipping_country_id, custom_value1, custom_value2, custom_value3, custom_value4, routing_id, is_tax_exempt, assigned_user_id, updated_at, created_at) values (1, 1, Goldbirch Ltd, ?, ?, ?, 0, 0, 826, 0, 8uuPzUL3gqK4CEYhmHbWqTpmUv5GGG2pRcsTq1kt, {"entity":"App\\Models\\Client","industry_id":"","size_id":"","currency_id":"2"}, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, 2023-12-11 12:29:18.364500, 2023-12-11 12:29:18.364500)) at /home/wiredspa/inv5.wiredspace.co.uk/vendor/laravel/framework/src/Illuminate/Database/Connection.php:822)
[stacktrace]

Tried updating using Softaculous but hasn’t fixed the error. Happens in web and app. v5.7.57-C143

Hi,

If you have SSH access try running php artisan migrate

1 Like

Thanks, tried that and looked to run ok (returned three blanks lines) but the error still exists. I’m guessing I can add the field via SQL? What does it need to be?

Can you please share the output of the command?

Are you running the command in the root folder of the app’s code?

Yes, I am running it from the same folder as the .env file

Not sure, I’d expect to see an output.

You can try loading /update?secret=secret in the browser to see if it helps.

Unfortunately that did not work.

@david do you have any suggestions?

I guess classifications are new? I just tried to create a vendor and the log shows a similar error for classification column missing from the ‘vendors’ table. What is odd is I don’t appear to have that in the front end to select for either clients or vendors? Feels like this is half completed update by Softaculous?

Correct, it’s a new field. It’s only shown in the UI if the auto-taxes feature is enabled.

1 Like

That makes sense then. I can see classification for my own company and I’ve set that fine just now. Is there some SQL I can run to create the missing fields?

Running the migrate command should create the missing fields, I’m not sure why it isn’t.

Looking at the changes that should be there in database/migrations, everything after the addition of the Nicaragua currency (2023_08_09_224955_add_nicaragua_currency.php) is missing. I am running on a ‘shared host’ cPanel site, could that have something to do with it? If I created a new Softaculous install on a different sub domain, is there an easy way to import the previous data and setting?

It’s possible the shared host is limiting commands needed by the migration. Have any migrations been run after you first setup the app?

It may be possible to use the JSON import/export option to transfer your data/settings.

I’ve run the Softaculous update a few times on this install and it has been fine each time.

Not all updates include migrations.

I ran a new install and the classification field shows in the clients table

The JSON import didn’t get my invoice numbering correct, I hope that is the only thing that is wrong on the data transfer.