SQLite Forum

Non primary key alias to rowid
Login
Hello

I used the rowid with the INTEGER PRIMARY KEY as an alias but with the session api
I had to use a different primary key because otherwise I could not track deleted
entries. But now I want to use FOREIGN KEYS too. And anyway rowid is not stable. Is there a way to map the rowid to a INTEGER UNIQUE column? Or what is the best to create a id column which is generating unique default integer ids(like rowid)?

Here some snippets from the table design:
CREATE TABLE IF NOT EXISTS translatables(id INTEGER NOT NULL UNIQUE, translationTextId TEXT PRIMARY KEY NOT NULL CHECK (translationTextId 
!= ''), screenId TEXT, defaultText TEXT)

CREATE TABLE IF NOT EXISTS translations(id INTEGER NOT NULL UNIQUE, 
translatableId INTEGER NOT NULL REFERENCES translatables(id) ON DELETE 
CASCADE, language TEXT NOT NULL CHECK (language != ''), translation 
TEXT, PRIMARY KEY(translatableId, language))


Thanks and best regards, Marco