CREATE TABLE `bot_options` (
	`guild_id` text PRIMARY KEY NOT NULL,
	`active_personality_id` text,
	`free_will_chance` integer DEFAULT 2,
	`memory_chance` integer DEFAULT 30,
	`mention_probability` integer DEFAULT 0,
	`updated_at` text DEFAULT (current_timestamp),
	FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `personalities` (
	`id` text PRIMARY KEY NOT NULL,
	`guild_id` text,
	`name` text NOT NULL,
	`system_prompt` text NOT NULL,
	`created_at` text DEFAULT (current_timestamp),
	`updated_at` text DEFAULT (current_timestamp),
	FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE INDEX `personality_guild_idx` ON `personalities` (`guild_id`);--> statement-breakpoint
CREATE TABLE `web_sessions` (
	`id` text PRIMARY KEY NOT NULL,
	`user_id` text NOT NULL,
	`access_token` text NOT NULL,
	`refresh_token` text,
	`expires_at` text NOT NULL,
	`created_at` text DEFAULT (current_timestamp)
);
