MYSQL Triggers unable to capture the USER

Ok. I’ll try to simplify this. So I have a MYSQL database with audit triggers. The problem I am having is that Appsheet sources a mysql database as a specific user. Let’s call this person USER A. This is the problem. Permissions to USER A have been granted already in MYSQL workbench. It allows USER A to view and edit data in mysql workbench. USER A has username and password to access this. That works fine and the permissions are perfect. Now I am trying to test out this process with appsheet. I have created an app and added the cloud database using USER A permissions to the mysql database in the cloud. The problem now is when i share the app, and have the need of 4 other users (e.g. USER B, C, D, E) to edit the data, the audit trigger only notes USER A instead of USER B, C, D, E in the database audit table. Does anyone know of a workaround to reliably track the changes in my database?

Solved Solved
0 8 674
1 ACCEPTED SOLUTION

Steve. I think i figured it out. This is what I did. I added a field to my MySQL Database called “AppSheet_Updated_By”. I then refreshed my tables in Appsheet to make sure the field was there. I then set the default value for that field to USERNAME(). So when I update a record the “Appsheet_Updated_by” field gets updated with the user’s email within my main database table. My database trigger then stores this value in the audit table once it syncs and the trigger goes off.

View solution in original post

8 REPLIES 8
Top Labels in this Space