CREATE TABLE writeopia_user_entity (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT NOT NULL,
  selected INTEGER NOT NULL,
  tier TEXT NOT NULL
);

selectUserByEmail:
SELECT *
FROM writeopia_user_entity
WHERE email = ?
LIMIT 1;

selectCurrentUser:
SELECT *
FROM writeopia_user_entity
WHERE selected = 1
LIMIT 1;

insertUser:
INSERT INTO writeopia_user_entity(id, name, email, selected, tier)
VALUES (?, ?, ?, ?, ?)
ON CONFLICT(id) DO
UPDATE SET id=excluded.id, name=excluded.name, email=excluded.email, selected=excluded.selected, tier=excluded.tier;

deleteUser:
DELETE
FROM writeopia_user_entity
WHERE id = ?;

deleteUserByEmail:
DELETE
FROM writeopia_user_entity
WHERE email = ?;
