snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.17k stars 3.2k forks source link

Asset Models Missing #15856

Open PP-JN-RL opened 4 days ago

PP-JN-RL commented 4 days ago

Debug mode

Describe the bug

After the latest update to 7.1.14, when navigating to Settings -> Asset Model, the UI show "No matching records found" Then creating a new asset, the asset models are listed correctly

Reproduction steps

  1. Click Settings
  2. Click Asset Models
  3. "No maching records found"

Expected behavior

This should list all existing asset models

Screenshots

No response

Snipe-IT Version

v7.0.14

Operating System

Official Docker Image (Ubuntu)

Web Server

Official Docker Image (Apache?)

PHP Version

8.1.2-1ubuntu2.19

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

No response

Additional context

No response

snipe commented 3 days ago

We'd need to see what's in your application logs, how you upgraded, whether there were any errors when you upgraded, etc.

PP-JN-RL commented 3 days ago

We use the official docker image, pulled down the latest version. I assume the image takes care of upgrading the DB? What logs can I provide to help you track down the issue?

Oddly enough I can see all the asset models when creating a new asset: image

But the view is empty when using Settings -> Asset Models: image

I believe this is the error it throws when loading the asset model view:

[15:43:58] LOG.error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_by' in field list is ambiguous (Connection: mysql, SQL: select `models`.`id`, `models`.`image`, `models`.`name`, `model_number`, `min_amt`, `eol`, `created_by`, `requestable`, `models`.`notes`, `models`.`created_at`, `category_id`, `manufacturer_id`, `depreciation_id`, `fieldset_id`, `models`.`deleted_at`, `models`.`updated_at`, (select count(*) from `assets` where `models`.`id` = `assets`.`model_id` and `assets`.`deleted_at` is null) as `assets_count` from `models` left join `manufacturers` on `models`.`manufacturer_id` = `manufacturers`.`id` where `models`.`deleted_at` is null order by `manufacturers`.`name` asc limit 100 offset 0) { "userId": 1, "exception": { "errorInfo": [ "23000", 1052, "Column 'created_by' in field list is ambiguous" ], "connectionName": "mysql" } }

PP-JN-RL commented 3 days ago

Ok, I think I have found the issue, but I'm not quite sure yet how it happened. There was a commit to specify the table name in AssetModelsController.php. This does not seem to have made it into the docker image I have pulled down. https://github.com/snipe/snipe-it/commit/4e28650ca9f3c6fd0cc85ac9a443db36847a9248

Update: I just pulled down the latest docker image and inspected it, I can confirm that there is an issue with the image. It has the same problem