feat: add OAuth tables (clients, codes, tokens) to schema

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 09:17:53 +02:00
parent c04b9b0e09
commit f47e1d74ae
4 changed files with 939 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
CREATE TABLE `oauth_clients` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`client_id` text NOT NULL,
`client_name` text,
`redirect_uris` text NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `oauth_clients_client_id_unique` ON `oauth_clients` (`client_id`);--> statement-breakpoint
CREATE TABLE `oauth_codes` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`code` text NOT NULL,
`client_id` text NOT NULL,
`code_challenge` text NOT NULL,
`code_challenge_method` text DEFAULT 'S256' NOT NULL,
`redirect_uri` text NOT NULL,
`expires_at` integer NOT NULL,
`used` integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `oauth_codes_code_unique` ON `oauth_codes` (`code`);--> statement-breakpoint
CREATE TABLE `oauth_tokens` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`access_token_hash` text NOT NULL,
`refresh_token_hash` text NOT NULL,
`client_id` text NOT NULL,
`expires_at` integer NOT NULL,
`refresh_expires_at` integer NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `oauth_tokens_access_token_hash_unique` ON `oauth_tokens` (`access_token_hash`);--> statement-breakpoint
CREATE UNIQUE INDEX `oauth_tokens_refresh_token_hash_unique` ON `oauth_tokens` (`refresh_token_hash`);