In order to work around problems that we’re waiting on work to occur around, I’ve had a look at manually adding a link between two assets in Matrix, via SQL at the postgres command prompt.
I suspect I need a subquery to populate a linkid value before my insert command will work based on the error I got back on our test system from a rollback trigger.
Are there any resource accessible to clients that goes into the database structure? Or would I need to log a support request to get assistance?
Following the SQL provided in Db questions I’ve got the INSERT working on our test system, although I’m not sure if I need to be more careful with the sort_order value - and I’m avoiding populating the is_dependant and is_exclusive values at the moment e.g. SQL is only:
INSERT INTO sq_ast_lnk (linkid,majorid,minorid,link_type,value,sort_order,updated,updated_userid) VALUES (NEXTVAL('sq_ast_lnk_seq')...
That forum post you’ve linked to was from nearly 10 years ago and I’d actually just meant it to be illustrating a problem I was having with the indexes applied to the table at the time. I would strongly encourage you to avoid adding links manually as there’s a complex relationship between tables that isn’t fully constrained by DB code.
Hence my query as to whether there’s any client accessible resources that discuss the database structure, how links (etc) get created and why you really should use an API instead of direct SQL.