Add users table to Drizzle schema (task 2.1)

Adds the `users` table to `src/lib/db/schema.ts` with:
- UUID primary key (defaultRandom)
- email (unique, not null)
- password_hash (nullable, for OAuth-only users)
- name, image (nullable)
- provider (default 'credentials'), provider_account_id (nullable)
- email_verified (timestamp, nullable)
- created_at, updated_at

Marks task 2.1 as complete in tasks.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marko Djordjevic 2026-02-20 09:46:20 +01:00
parent d05ed21cd6
commit 9101cfb7af
2 changed files with 15 additions and 2 deletions

View file

@ -1,4 +1,17 @@
import { pgTable, serial, text, timestamp, doublePrecision, integer, boolean, jsonb, uniqueIndex } from 'drizzle-orm/pg-core';
import { pgTable, serial, text, timestamp, doublePrecision, integer, boolean, jsonb, uniqueIndex, uuid } from 'drizzle-orm/pg-core';
export const users = pgTable('users', {
id: uuid('id').primaryKey().defaultRandom(),
email: text('email').notNull().unique(),
password_hash: text('password_hash'), // null for OAuth-only users
name: text('name'),
image: text('image'),
provider: text('provider').notNull().default('credentials'), // 'credentials' | 'google'
provider_account_id: text('provider_account_id'), // Google sub ID
email_verified: timestamp('email_verified'), // nullable — set when email is verified
created_at: timestamp('created_at').notNull().defaultNow(),
updated_at: timestamp('updated_at').notNull().defaultNow(),
});
export const charts = pgTable('charts', {
id: serial('id').primaryKey(),