- Introduced new database migration for enhanced user and organization management. - Updated package dependencies to include new Better Auth modules for API keys, Expo, and i18n. - Implemented SMS functionality for phone verification and password resets. - Enhanced authentication plugins with username and phone number support. - Added performance configuration options for session cookie caching and API key updates. - Updated email templates to include organization invitation messages. - Improved testing coverage for new features and configurations.
61 lines
4.8 KiB
SQL
61 lines
4.8 KiB
SQL
create 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, "twoFactorEnabled" integer, "lastLoginMethod" text, "role" text, "banned" integer, "banReason" text, "banExpires" date, "username" text unique, "displayUsername" text, "phoneNumber" text unique, "phoneNumberVerified" integer);
|
|
|
|
create 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, "impersonatedBy" text, "activeOrganizationId" text, "activeTeamId" text);
|
|
|
|
create 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);
|
|
|
|
create 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);
|
|
|
|
create table "twoFactor" ("id" text not null primary key, "secret" text not null, "backupCodes" text not null, "userId" text not null references "user" ("id") on delete cascade, "verified" integer);
|
|
|
|
create table "passkey" ("id" text not null primary key, "name" text, "publicKey" text not null, "userId" text not null references "user" ("id") on delete cascade, "credentialID" text not null, "counter" integer not null, "deviceType" text not null, "backedUp" integer not null, "transports" text, "createdAt" date, "aaguid" text);
|
|
|
|
create table "organization" ("id" text not null primary key, "name" text not null, "slug" text not null unique, "logo" text, "createdAt" date not null, "metadata" text);
|
|
|
|
create table "team" ("id" text not null primary key, "name" text not null, "organizationId" text not null references "organization" ("id") on delete cascade, "createdAt" date not null, "updatedAt" date);
|
|
|
|
create table "teamMember" ("id" text not null primary key, "teamId" text not null references "team" ("id") on delete cascade, "userId" text not null references "user" ("id") on delete cascade, "createdAt" date);
|
|
|
|
create table "member" ("id" text not null primary key, "organizationId" text not null references "organization" ("id") on delete cascade, "userId" text not null references "user" ("id") on delete cascade, "role" text not null, "createdAt" date not null);
|
|
|
|
create table "invitation" ("id" text not null primary key, "organizationId" text not null references "organization" ("id") on delete cascade, "email" text not null, "role" text, "teamId" text, "status" text not null, "expiresAt" date not null, "createdAt" date not null, "inviterId" text not null references "user" ("id") on delete cascade);
|
|
|
|
create table "apikey" ("id" text not null primary key, "configId" text not null, "name" text, "start" text, "referenceId" text not null, "prefix" text, "key" text not null, "refillInterval" integer, "refillAmount" integer, "lastRefillAt" date, "enabled" integer, "rateLimitEnabled" integer, "rateLimitTimeWindow" integer, "rateLimitMax" integer, "requestCount" integer, "remaining" integer, "lastRequest" date, "expiresAt" date, "createdAt" date not null, "updatedAt" date not null, "permissions" text, "metadata" text);
|
|
|
|
create table "jwks" ("id" text not null primary key, "publicKey" text not null, "privateKey" text not null, "createdAt" date not null, "expiresAt" date);
|
|
|
|
create index "session_userId_idx" on "session" ("userId");
|
|
|
|
create index "account_userId_idx" on "account" ("userId");
|
|
|
|
create index "verification_identifier_idx" on "verification" ("identifier");
|
|
|
|
create index "twoFactor_secret_idx" on "twoFactor" ("secret");
|
|
|
|
create index "twoFactor_userId_idx" on "twoFactor" ("userId");
|
|
|
|
create index "passkey_userId_idx" on "passkey" ("userId");
|
|
|
|
create index "passkey_credentialID_idx" on "passkey" ("credentialID");
|
|
|
|
create unique index "organization_slug_uidx" on "organization" ("slug");
|
|
|
|
create index "team_organizationId_idx" on "team" ("organizationId");
|
|
|
|
create index "teamMember_teamId_idx" on "teamMember" ("teamId");
|
|
|
|
create index "teamMember_userId_idx" on "teamMember" ("userId");
|
|
|
|
create index "member_organizationId_idx" on "member" ("organizationId");
|
|
|
|
create index "member_userId_idx" on "member" ("userId");
|
|
|
|
create index "invitation_organizationId_idx" on "invitation" ("organizationId");
|
|
|
|
create index "invitation_email_idx" on "invitation" ("email");
|
|
|
|
create index "apikey_configId_idx" on "apikey" ("configId");
|
|
|
|
create index "apikey_referenceId_idx" on "apikey" ("referenceId");
|
|
|
|
create index "apikey_key_idx" on "apikey" ("key"); |