Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do you determine the next ID for inserting rows manually into the Crowd DB?

Graham Bakay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

Hi everyone,

I would like to bulk-add some user memberships in Crowd. It appears the easiest way to do that would be to just add records into the cwd_membership table with the appropriate columns. However, it looks like all the records in Crowd require a unique ID. How do I determine the next in that sequence? It doesn't appear that the ID field is auto-increment.

Thanks in advance,

Graham.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
JustinK
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2012
You can also make use of the REST API's that crowd exposes and simply write a script that makes use of these. https://developer.atlassian.com/display/CROWDDEV/Crowd+REST+APIs
Graham Bakay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012

I guess I'll go that route. Was hoping to be able to do it directly in the DB, as I'm migrating group memberships from a Crowd 1.6.x instance in a separate schema.

Thanks, Justin.

g.

JustinK
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 4, 2012

Yes, sorry about this Graham. All Atlassian apps use the same approach for their sequencing. The reason why we do this is because we want to be able to have a database neutral way of controling sequence numbers, and to also have a way of controlling sequences after you export the data from your Atlassian product to XML, and re-import it elsewhere.

Graham Bakay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 5, 2012

Makes sense. Thanks.

g.

1 vote
Septa Cahyadiputra
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

Hi Graham,

I think the next id should be stored on this table

  • hibernate_unique_key

You might want to double check that. Hope it helps.

Cheers,

Septa Cahyadiputra

Graham Bakay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

In my instance, the value of the next_hi column in hibernate_unique_key is only 49, whereas the highest ID I can find is 1474667, so I don't think that's doing it. :/

Septa Cahyadiputra
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 31, 2012

As describe here :

Crowd use ResettableTableHiLoGenerator to generate the next unique key.

Hope it helps.

Cheers,
Septa Cahyadiputra

Graham Bakay
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 1, 2012

So I'm assuming there is no way to properly add rows to the database manually. It has to be done inside the application.

TAGS
AUG Leaders

Atlassian Community Events