-- It is unclear weather this table will be used -- Create the table to store hash salts CREATE TABLE salts ( id INTEGER PRIMARY KEY, salt TEXT NOT NULL ); -- Create a trigger to automatically generate a salt when inserting a new user record CREATE TRIGGER generate_salt_trigger AFTER INSERT ON users BEGIN INSERT INTO salts (salt) VALUES (randomblob(16)); UPDATE users SET salt_id = (SELECT last_insert_rowid()) WHERE id = new.id; END;