Thanks Marcel for your reply.
I have already added the field to the database.
I have already modified the ini to call the lua script every time the study is received.
What I am asking you for is help with the lua dbquery and sql functions since I am not familiar with them. If there is any documentation to read, I would appreciate it. I did some basic query tests but was unsuccessful. I also do not understand how the connection is configured or if it is already established globally.
The db is postgresql with the native conquest driver.
As always, thank you.