Hi!
I am trying to figure out how database table ids (primary keys) are generated/calculated/incremented? I actually thought it's a usual increment by 1.
What I did:
I manually added data rows to CONTENT_PERM_SET and CONTENT_PERM. For the ID I was using the last value and incremented by 1, for each table entry. Then I restarted the Confluence service. The restrictions on all the pages are totally fine. Everything seems to work.
Then I manually added another restriction via Confluence and just figured out, that the ID which was created in CONTENT_PERM_SET is miles away from my last ID I've created directly in the database table.
Is there a special way to calculate the next ID if I want to manually add entries directly into the database tables via script? Is it somehow depenend from other values (creation date, content id, etc.)?
We are using MS-SQL for the database.
Thanks in advance & Cheers
Tom
Community moderators have prevented the ability to post new answers.
Hi Tom,
The IDs in Confluence are generated using Hibernate - we use a customised ID generator which you can see in the Confluence source if you go hunting for com.atlassian.hibernate.ResettableTableHiLoGenerator
There is no problem if the rows you have added use IDs that are not sequential or contiguous with other rows in the table - everything will still work fine.
However, generally we would discourage you from interacting with the database directly - and instead use something like the Confluence SOAP/XML-RPC API or the Confluence CLI Tool.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.