Branchwell

AI Resource Pro / website / d1 / migrations / 0002_better_auth.sql

1-- Generated from Better Auth 1.7.28 for Cloudflare D1.
2create table "user" ("id" text not null primary key, "name" text not null, "email" text not null unique, "emailVerified" integer not null, "image" text, "createdAt" date not null, "updatedAt" date not null);
3
4create table "session" ("id" text not null primary key, "expiresAt" date not null, "token" text not null unique, "createdAt" date not null, "updatedAt" date not null, "ipAddress" text, "userAgent" text, "userId" text not null references "user" ("id") on delete cascade);
5
6create table "account" ("id" text not null primary key, "accountId" text not null, "providerId" text not null, "userId" text not null references "user" ("id") on delete cascade, "accessToken" text, "refreshToken" text, "idToken" text, "accessTokenExpiresAt" date, "refreshTokenExpiresAt" date, "scope" text, "password" text, "createdAt" date not null, "updatedAt" date not null);
7
8create table "verification" ("id" text not null primary key, "identifier" text not null, "value" text not null, "expiresAt" date not null, "createdAt" date not null, "updatedAt" date not null);
9
10create table "rateLimit" ("id" text not null primary key, "key" text not null unique, "count" integer not null, "lastRequest" bigint not null);
11
12create index "session_userId_idx" on "session" ("userId");
13
14create index "account_userId_idx" on "account" ("userId");
15
16create index "verification_identifier_idx" on "verification" ("identifier");
17
18CREATE UNIQUE INDEX "account_provider_subject" ON "account" ("providerId", "accountId");
19
20ALTER TABLE "user" ADD COLUMN "provider" TEXT CHECK ("provider" IN ('apple', 'google'));