CREATE TABLE `accounts` ( `id` text PRIMARY KEY NOT NULL, `account_id` text NOT NULL, `provider_id` text NOT NULL, `user_id` text NOT NULL, `access_token` text, `refresh_token` text, `id_token` text, `access_token_expires_at` integer, `refresh_token_expires_at` integer, `scope` text, `password` text, `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL, `updated_at` integer NOT NULL, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE INDEX `accounts_userId_idx` ON `accounts` (`user_id`);--> statement-breakpoint CREATE TABLE `jwkss` ( `id` text PRIMARY KEY NOT NULL, `public_key` text NOT NULL, `private_key` text NOT NULL, `created_at` integer NOT NULL, `expires_at` integer ); --> statement-breakpoint CREATE TABLE `oauth_access_tokens` ( `id` text PRIMARY KEY NOT NULL, `token` text, `client_id` text NOT NULL, `session_id` text, `user_id` text, `reference_id` text, `refresh_id` text, `expires_at` integer, `created_at` integer, `scopes` text NOT NULL, FOREIGN KEY (`client_id`) REFERENCES `oauth_clients`(`client_id`) ON UPDATE no action ON DELETE cascade, FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE set null, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade, FOREIGN KEY (`refresh_id`) REFERENCES `oauth_refresh_tokens`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE UNIQUE INDEX `oauth_access_tokens_token_unique` ON `oauth_access_tokens` (`token`);--> statement-breakpoint CREATE TABLE `oauth_clients` ( `id` text PRIMARY KEY NOT NULL, `client_id` text NOT NULL, `client_secret` text, `disabled` integer DEFAULT false, `skip_consent` integer, `enable_end_session` integer, `subject_type` text, `scopes` text, `user_id` text, `created_at` integer, `updated_at` integer, `name` text, `uri` text, `icon` text, `contacts` text, `tos` text, `policy` text, `software_id` text, `software_version` text, `software_statement` text, `redirect_uris` text NOT NULL, `post_logout_redirect_uris` text, `token_endpoint_auth_method` text, `grant_types` text, `response_types` text, `public` integer, `type` text, `require_pkce` integer, `reference_id` text, `metadata` text, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE UNIQUE INDEX `oauth_clients_client_id_unique` ON `oauth_clients` (`client_id`);--> statement-breakpoint CREATE TABLE `oauth_consents` ( `id` text PRIMARY KEY NOT NULL, `client_id` text NOT NULL, `user_id` text, `reference_id` text, `scopes` text NOT NULL, `created_at` integer, `updated_at` integer, FOREIGN KEY (`client_id`) REFERENCES `oauth_clients`(`client_id`) ON UPDATE no action ON DELETE cascade, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE TABLE `oauth_refresh_tokens` ( `id` text PRIMARY KEY NOT NULL, `token` text NOT NULL, `client_id` text NOT NULL, `session_id` text, `user_id` text NOT NULL, `reference_id` text, `expires_at` integer, `created_at` integer, `revoked` integer, `auth_time` integer, `scopes` text NOT NULL, FOREIGN KEY (`client_id`) REFERENCES `oauth_clients`(`client_id`) ON UPDATE no action ON DELETE cascade, FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE set null, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE TABLE `sessions` ( `id` text PRIMARY KEY NOT NULL, `expires_at` integer NOT NULL, `token` text NOT NULL, `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL, `updated_at` integer NOT NULL, `ip_address` text, `user_agent` text, `user_id` text NOT NULL, `impersonated_by` text, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE UNIQUE INDEX `sessions_token_unique` ON `sessions` (`token`);--> statement-breakpoint CREATE INDEX `sessions_userId_idx` ON `sessions` (`user_id`);--> statement-breakpoint CREATE TABLE `users` ( `id` text PRIMARY KEY NOT NULL, `name` text NOT NULL, `email` text NOT NULL, `email_verified` integer DEFAULT false NOT NULL, `image` text, `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL, `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL, `role` text, `banned` integer DEFAULT false, `ban_reason` text, `ban_expires` integer, `preferred_username` text ); --> statement-breakpoint CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint CREATE TABLE `verifications` ( `id` text PRIMARY KEY NOT NULL, `identifier` text NOT NULL, `value` text NOT NULL, `expires_at` integer NOT NULL, `created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL, `updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL ); --> statement-breakpoint CREATE INDEX `verifications_identifier_idx` ON `verifications` (`identifier`);--> statement-breakpoint CREATE TABLE `invites` ( `id` text PRIMARY KEY NOT NULL, `token_hash` text NOT NULL, `email` text NOT NULL, `created_by` text NOT NULL, `created_at` text DEFAULT (current_timestamp) NOT NULL, `expires_at` text NOT NULL, `consumed_at` text ); --> statement-breakpoint CREATE UNIQUE INDEX `idx_invites_token_hash` ON `invites` (`token_hash`);--> statement-breakpoint CREATE UNIQUE INDEX `idx_invites_email` ON `invites` (`email`);--> statement-breakpoint CREATE INDEX `idx_invites_created_by_created_at` ON `invites` (`created_by`,`created_at`);--> statement-breakpoint CREATE INDEX `idx_invites_expires_at` ON `invites` (`expires_at`);