14 lines
No EOL
558 B
SQL
14 lines
No EOL
558 B
SQL
-- Id is a surrogate key for in ternal use
|
|
-- userId is what is used for external id
|
|
-- username is what is used for login
|
|
-- password is the hashed password
|
|
CREATE TABLE IF NOT EXISTS users (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
userId TEXT DEFAULT (HEX(RANDOMBLOB(4))) NOT NULL UNIQUE,
|
|
username VARCHAR(255) NOT NULL UNIQUE,
|
|
password VARCHAR(255) NOT NULL
|
|
);
|
|
|
|
-- Users are commonly searched by username and userId
|
|
CREATE INDEX IF NOT EXISTS users_username_index ON users (username);
|
|
CREATE INDEX IF NOT EXISTS users_userId_index ON users (userId); |