snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

People empty after upgrade

Open mprcel opened this issue 3 years ago • 3 comments

Debug mode

Describe the bug

Upgraded to v6.1 on Windows. Hqad a good few issues but got most of them ironed out. I can get in but the only table hat seems to be populated is the assets table. People is empty, but I can see a user assinged to an asset. If I click the user in the asset it gives me a 500 error. I assume it has something to do with the DB error .I have a few erroris in the Laravel log file:

[previous exception] [object] (PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column

Next Illuminate\Database\QueryException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.created_by' in 'field list' (SQL: select users.activated, users.created_by, users.address, users.avatar, users.city, users.company_id, users.country, users.created_at, users.deleted_at, users.department_id, users.email, users.employee_num, users.first_name, users.id, users.jobtitle, users.last_login, users.last_name, users.locale, users.location_id, users.manager_id, users.notes, users.permissions, users.phone, users.state, users.two_factor_enrolled, users.two_factor_optin, users.updated_at, users.username, users.zip, users.remote, users.ldap_import, users.start_date, users.end_date, users.vip, users.autoassign_licenses, (select count() from assets where users.id = assets.assigned_to and assets.assigned_type = App\Models\User) as assets_count, (select count() from licenses inner join license_seats on licenses.id = license_seats.license_id where users.id = license_seats.assigned_to and licenses.deleted_at is null) as licenses_count, (select count() from accessories inner join accessories_users on accessories.id = accessories_users.accessory_id where users.id = accessories_users.assigned_to) as accessories_count, (select count() from consumables inner join consumables_users on consumables.id = consumables_users.consumable_id where users.id = consumables_users.assigned_to) as consumables_count from users where users.deleted_at is null order by first_name asc limit 20 offset 0) in C:\inetpub\wwwroot\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Connection.php:712 Stack trace:

15:52:20] production.ERROR: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.created_by' in 'field list' in C:\inetpub\wwwroot\snipe-it\vendor\laravel\framework\src\Illuminate\Database\Connection.php:368 Stack trace:

15:51:28] local.ERROR: Call to undefined function Illuminate\Support\mb_strimwidth() {"exception":"[object] (Error(code: 0): Call to undefined function Illuminate\Support\mb_strimwidth() at C:\inetpub\wwwroot\snipe-it\vendor\laravel\framework\src\Illuminate\Support\Str.php:367)

Reproduction steps

1. 2. 3. ...

Expected behavior

SHould be qable to see existing people in database

Screenshots

No response

Snipe-IT Version

6.1.0

Operating System

Windows Server 2012 R2

Web Server

IIS

PHP Version

8.2.5

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

[2023-05-12 15:52:20] production.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.created_by' in 'field list' (SQL: select `users`.`activated`, `users`.`created_by`, `users`.`address`, `users`.`avatar`, `users`.`city`, `users`.`company_id`, `users`.`country`, `users`.`created_at`, `users`.`deleted_at`, `users`.`department_id`, `users`.`email`, `users`.`employee_num`, `users`.`first_name`, `users`.`id`, `users`.`jobtitle`, `users`.`last_login`, `users`.`last_name`, `users`.`locale`, `users`.`location_id`, `users`.`manager_id`, `users`.`notes`, `users`.`permissions`, `users`.`phone`, `users`.`state`, `users`.`two_factor_enrolled`, `users`.`two_factor_optin`, `users`.`updated_at`, `users`.`username`, `users`.`zip`, `users`.`remote`, `users`.`ldap_import`, `users`.`start_date`, `users`.`end_date`, `users`.`vip`, `users`.`autoassign_licenses`, (select count(*) from `assets` where `users`.`id` = `assets`.`assigned_to` and `assets`.`assigned_type` = App\Models\User) as `assets_count`, (select count(*) from `licenses` inner join `license_seats` on `licenses`.`id` = `license_seats`.`license_id` where `users`.`id` = `license_seats`.`assigned_to` and `licenses`.`deleted_at` is null) as `licenses_count`, (select count(*) from `accessories` inner join `accessories_users` on `accessories`.`id` = `accessories_users`.`accessory_id` where `users`.`id` = `accessories_users`.`assigned_to`) as `accessories_count`, (select count(*) from `consumables` inner join `consumables_users` on `consumables`.`id` = `consumables_users`.`consumable_id` where `users`.`id` = `consumables_users`.`assigned_to`) as `consumables_count` from `users` where `users`.`deleted_at` is null order by `first_name` asc limit 20 offset 0) {"userId":70,"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.created_by' in 'field list' (SQL: select `users`.`activated`, `users`.`created_by`, `users`.`address`, `users`.`avatar`, `users`.`city`, `users`.`company_id`, `users`.`country`, `users`.`created_at`, `users`.`deleted_at`, `users`.`department_id`, `users`.`email`, `users`.`employee_num`, `users`.`first_name`, `users`.`id`, `users`.`jobtitle`, `users`.`last_login`, `users`.`last_name`, `users`.`locale`, `users`.`location_id`, `users`.`manager_id`, `users`.`notes`, `users`.`permissions`, `users`.`phone`, `users`.`state`, `users`.`two_factor_enrolled`, `users`.`two_factor_optin`, `users`.`updated_at`, `users`.`username`, `users`.`zip`, `users`.`remote`, `users`.`ldap_import`, `users`.`start_date`, `users`.`end_date`, `users`.`vip`, `users`.`autoassign_licenses`, (select count(*) from `assets` where `users`.`id` = `assets`.`assigned_to` and `assets`.`assigned_type` = App\\Models\\User) as `assets_count`, (select count(*) from `licenses` inner join `license_seats` on `licenses`.`id` = `license_seats`.`license_id` where `users`.`id` = `license_seats`.`assigned_to` and `licenses`.`deleted_at` is null) as `licenses_count`, (select count(*) from `accessories` inner join `accessories_users` on `accessories`.`id` = `accessories_users`.`accessory_id` where `users`.`id` = `accessories_users`.`assigned_to`) as `accessories_count`, (select count(*) from `consumables` inner join `consumables_users` on `consumables`.`id` = `consumables_users`.`consumable_id` where `users`.`id` = `consumables_users`.`assigned_to`) as `consumables_count` from `users` where `users`.`deleted_at` is null order by `first_name` asc limit 20 offset 0) at C:\\inetpub\\wwwroot\\snipe-it\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:712)
[stacktrace]

Additional context

No response

mprcel avatar May 12 '23 15:05 mprcel

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

welcome[bot] avatar May 12 '23 15:05 welcome[bot]

I had a very similar environment setup for Snipe-IT when upgrading to 6.0.8. I ran the 'php artisan migrate' to resolve that issue. Otherwise, check out this link that goes through a few things to look at. https://github.com/snipe/snipe-it/issues/8881

kennj3 avatar May 12 '23 16:05 kennj3

Hey @kennj3, I did try that but you got me digging deeper. There was a huge amount of underlying issues I need to resolve. I wanted to rerun "composer install --no-dev --prefer-source" but that had it's own issues. I had to edit composer.json to to accpept PHP 8.2.5 (it only went up to 8.2), update composer (which required getting cacert.pem and referencing the curl.cainfo and openssl.cafile php.ini). Only then would it let me update composer and rerun composer install --no-dev --prefer-source. Finally managed to successfully do a php artisan migrate followed by a php artisan up (@snipe thanks for that one).

Huge amount of resources available but thanks to @kennj3 for getting me going in the right direction !!!!

mprcel avatar May 15 '23 11:05 mprcel