I'm trying to increment a sequence in sqlite3.
Basically, I'm using the sequence as a key into another system, and I have multiple DB's which are generating conflicts.
i.e. I have 2 DB's both creating entries with the same sequence number. They both create a 15, which I use as a key to another system.
I'd like to advance one of the DB's sequences by, say 10 000, so that I stop getting conflicts.
Disclaimer: before you start jumping all over me, I know this is not a good design, and it's only being used for early prototyping. I plan to 'upgrade' to using a UUID generated from the sequence and timestamp as my key in the future. However, until I'm out of 'demo mode' I just want to fix my problem with a line of SQL if I can.
I've tried update sqlite_sequence set seq = 2000 where name = 'XXXX';
but it doesn't seem to do the trick. I'm new to sqlite3, maybe it's something else?
Let me get this straight (and no, I'm not judging). This would be your sequence of events:
If I am mistaken, please let me know, and I will work from there.
This issue seems to be getting a lot of attention, so I thought I would post the actual code I'm using with minimal scrubbing. This is in my seeds.rb file.
So, not sure what I was doing wrong before, but the code I originally put in my question is working for me now.