Replies: 3 comments
|
You don't need to use the If you change your script to instead add to the INSERT INTO company_users (user_id,company_id) VALUES ($user_id,$company_id);Or if you are doing something in pure SQL, maybe something like - INSERT INTO company_users (user_id,company_id) VALUES (SELECT id,CASE country WHEN 'us' THEN 1 WHEN 'jp' THEN 2 WHEN 'pt' THEN 3 ELSE 4 END FROM users WHERE /* something? */) |
0 replies
|
Thank you @uberbrady ! I'll try that. At the moment I am using this AssignCompany.sql script which will get started by a .bat script which will get started by a scheduled task once an hour 😄 |
0 replies
|
We really discourage folks from directly editing data via SQL versus using the API. The schema changes all the time, and the API handles those types of things for you. https://snipe-it.readme.io/docs/manually-editing-data
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Snipe-IT Version
v8.6.3 build 23252
PHP Version
8.5.3
Composer Version
2.8.1
MySQL/MariaDB version
MariaDB 12.2.2
How did you install Snipe-IT?
Git install
Is this a fresh install or an upgrade?
Upgrade
What happened?
Since the last update to Snipe-IT version v8.6.3 build 23252 it is not possible anymore to manually assign a company to a user via SQL. Before the update I used a SQL script which assigned the users automatically to their companies based on their country.
As I can see there is now an additional table called "company_user". If I manually change the company of a user via SQL in the table "users" the changes will not be duplicated in the "company_user" table. This causes the issue, that the user cannot accept an asset assigned to him. Error: "Checkout company and asset-company are not the same".
The user looks totally fine in Snipe-IT and the asset as well. But if I check the table "company_user" there is no entry with the user ID. After assigning a different company to the user via Snipe-IT website and after that assigning back to the correct company the user ID will be listed in the "company_user" table.
Is there any possibility to get both tables updated simultaneously?
What browsers are you seeing the problem on?
No response
Can you reproduce this on the public demo?
N/A
Do you have full multiple company support enabled?
Yes
If you have full multiple company support enabled, do you have location scoping to company enabled?
No
Application log output
Browser console output
Common Issues
Code of Conduct
All reactions