33 lines
1.3 KiB
SQL
33 lines
1.3 KiB
SQL
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`); |