feat(auth): add user profile, phone login, and account deletion
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- SQLite cannot drop a NOT NULL constraint via ALTER, so rebuild the users
|
||||
-- table: email becomes nullable, phone is added as a unique second identifier,
|
||||
-- and existing rows are carried across (phone stays NULL).
|
||||
CREATE TABLE users_new (
|
||||
id TEXT PRIMARY KEY,
|
||||
email TEXT UNIQUE,
|
||||
phone TEXT UNIQUE,
|
||||
password_hash TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
avatar_url TEXT,
|
||||
preferences TEXT NOT NULL DEFAULT '{}',
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
||||
);
|
||||
|
||||
INSERT INTO users_new (id, email, phone, password_hash, name, avatar_url, preferences, created_at)
|
||||
SELECT id, email, NULL, password_hash, name, avatar_url, preferences, created_at FROM users;
|
||||
|
||||
DROP TABLE users;
|
||||
|
||||
ALTER TABLE users_new RENAME TO users;
|
||||
Reference in New Issue
Block a user