From 5a8c0028d7325cb46bd1f046cef278d7f1ae3d72 Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Sun, 25 Jan 2026 12:14:34 -0600 Subject: [PATCH] Add user_credentials migration --- .../2026-01-01_03-user-credentials.sql | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 express/framework/migrations/2026-01-01_03-user-credentials.sql diff --git a/express/framework/migrations/2026-01-01_03-user-credentials.sql b/express/framework/migrations/2026-01-01_03-user-credentials.sql new file mode 100644 index 0000000..ca3acc7 --- /dev/null +++ b/express/framework/migrations/2026-01-01_03-user-credentials.sql @@ -0,0 +1,17 @@ +-- 0003_user_credentials.sql +-- Create user_credentials table for password storage (extensible for other auth methods) + +CREATE TABLE user_credentials ( + id UUID PRIMARY KEY, + user_id UUID NOT NULL REFERENCES users(id), + credential_type TEXT NOT NULL DEFAULT 'password', + password_hash TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +-- Each user can have at most one credential per type +CREATE UNIQUE INDEX user_credentials_user_type_idx ON user_credentials (user_id, credential_type); + +-- Index for user lookups +CREATE INDEX user_credentials_user_id_idx ON user_credentials (user_id);