diff --git a/bun.lockb b/bun.lockb index e600fc8..d4a7fe6 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/drizzle.config.ts b/drizzle.config.ts index 9926057..8939f70 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -3,7 +3,7 @@ import type { Config } from "drizzle-kit"; export default { schema: "./src/database/schema.ts", out: "./src/database/drizzle", - dialect: "turso", + dialect: "sqlite", dbCredentials: { url: process.env.DATABASE_PATH ?? "./data/db.sqlite3", }, diff --git a/package.json b/package.json index 3729167..1c0d724 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "devDependencies": { "@types/bun": "latest", - "drizzle-kit": "^0.31.8" + "drizzle-kit": "^1.0.0-beta.15-859cf75" }, "peerDependencies": { "typescript": "^5.0.0" @@ -30,7 +30,7 @@ "@libsql/client": "^0.17.0", "ai": "^3.1.12", "discord.js": "^14.14.1", - "drizzle-orm": "^0.45.1", + "drizzle-orm": "^1.0.0-beta.15-859cf75", "hono": "^4.11.7", "libsql": "^0.3.18", "openai": "^4.36.0", diff --git a/src/database/drizzle/0000_fast_lester.sql b/src/database/drizzle/0000_fast_lester.sql deleted file mode 100644 index 215ed65..0000000 --- a/src/database/drizzle/0000_fast_lester.sql +++ /dev/null @@ -1,41 +0,0 @@ -CREATE TABLE `guilds` ( - `id` text PRIMARY KEY NOT NULL, - `name` text -); ---> statement-breakpoint -CREATE TABLE `membership` ( - `user_id` text, - `guild_id` text -); ---> statement-breakpoint -CREATE TABLE `memories` ( - `id` text PRIMARY KEY NOT NULL, - `content` text, - `timestamp` text DEFAULT (current_timestamp), - `user_id` integer, - `guild_id` integer, - FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON UPDATE no action ON DELETE no action -); ---> statement-breakpoint -CREATE TABLE `messages` ( - `id` text PRIMARY KEY NOT NULL, - `content` text, - `timestamp` text DEFAULT (current_timestamp), - `channel_id` text, - `user_id` text, - `guild_id` text, - FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON UPDATE no action ON DELETE no action -); ---> statement-breakpoint -CREATE TABLE `users` ( - `id` text PRIMARY KEY NOT NULL, - `name` text, - `opt_out` integer -); ---> statement-breakpoint -CREATE INDEX `user_guild_idx` ON `membership` (`user_id`,`guild_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `user_guild_unique` ON `membership` (`user_id`,`guild_id`);--> statement-breakpoint -CREATE INDEX `user_timestamp_idx` ON `memories` (`user_id`,`timestamp`);--> statement-breakpoint -CREATE INDEX `channel_timestamp_idx` ON `messages` (`channel_id`,`timestamp`); \ No newline at end of file diff --git a/src/database/drizzle/0001_rich_star_brand.sql b/src/database/drizzle/0001_rich_star_brand.sql deleted file mode 100644 index 1fd9ab9..0000000 --- a/src/database/drizzle/0001_rich_star_brand.sql +++ /dev/null @@ -1,16 +0,0 @@ -PRAGMA foreign_keys=OFF;--> statement-breakpoint -CREATE TABLE `__new_memories` ( - `id` text PRIMARY KEY NOT NULL, - `content` text, - `timestamp` text DEFAULT (current_timestamp), - `user_id` text, - `guild_id` text, - FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) ON UPDATE no action ON DELETE no action -); ---> statement-breakpoint -INSERT INTO `__new_memories`("id", "content", "timestamp", "user_id", "guild_id") SELECT "id", "content", "timestamp", "user_id", "guild_id" FROM `memories`;--> statement-breakpoint -DROP TABLE `memories`;--> statement-breakpoint -ALTER TABLE `__new_memories` RENAME TO `memories`;--> statement-breakpoint -PRAGMA foreign_keys=ON;--> statement-breakpoint -CREATE INDEX `user_timestamp_idx` ON `memories` (`user_id`,`timestamp`); \ No newline at end of file diff --git a/src/database/drizzle/0002_robust_saracen.sql b/src/database/drizzle/0002_robust_saracen.sql deleted file mode 100644 index 3792f17..0000000 --- a/src/database/drizzle/0002_robust_saracen.sql +++ /dev/null @@ -1,29 +0,0 @@ -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) -); diff --git a/src/database/drizzle/0003_silky_sauron.sql b/src/database/drizzle/0003_silky_sauron.sql deleted file mode 100644 index 00505db..0000000 --- a/src/database/drizzle/0003_silky_sauron.sql +++ /dev/null @@ -1,20 +0,0 @@ --- Rename timestamp to created_at -ALTER TABLE `memories` RENAME COLUMN "timestamp" TO "created_at";--> statement-breakpoint - --- Drop old index if it exists (ignore errors) -DROP INDEX IF EXISTS `user_timestamp_idx`;--> statement-breakpoint - --- Add new columns -ALTER TABLE `memories` ADD `category` text DEFAULT 'general';--> statement-breakpoint -ALTER TABLE `memories` ADD `importance` integer DEFAULT 5;--> statement-breakpoint -ALTER TABLE `memories` ADD `source_message_id` text;--> statement-breakpoint -ALTER TABLE `memories` ADD `last_accessed_at` text;--> statement-breakpoint -ALTER TABLE `memories` ADD `access_count` integer DEFAULT 0;--> statement-breakpoint -ALTER TABLE `memories` ADD `embedding` text;--> statement-breakpoint - --- Create new indexes for memories -CREATE INDEX IF NOT EXISTS `memory_user_idx` ON `memories` (`user_id`);--> statement-breakpoint -CREATE INDEX IF NOT EXISTS `memory_guild_idx` ON `memories` (`guild_id`);--> statement-breakpoint -CREATE INDEX IF NOT EXISTS `memory_user_importance_idx` ON `memories` (`user_id`,`importance`);--> statement-breakpoint -CREATE INDEX IF NOT EXISTS `memory_category_idx` ON `memories` (`category`);--> statement-breakpoint -CREATE INDEX IF NOT EXISTS `memory_user_category_idx` ON `memories` (`user_id`,`category`); \ No newline at end of file diff --git a/src/database/drizzle/0004_add_gif_search.sql b/src/database/drizzle/0004_add_gif_search.sql deleted file mode 100644 index 2075255..0000000 --- a/src/database/drizzle/0004_add_gif_search.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Add gif_search_enabled column to bot_options -ALTER TABLE `bot_options` ADD `gif_search_enabled` integer DEFAULT 0; diff --git a/src/database/drizzle/0005_add_channel_restriction.sql b/src/database/drizzle/0005_add_channel_restriction.sql deleted file mode 100644 index 87250f4..0000000 --- a/src/database/drizzle/0005_add_channel_restriction.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Add channel restriction to bot_options --- Joel can be limited to respond only in a specific channel -ALTER TABLE bot_options ADD COLUMN restricted_channel_id TEXT; diff --git a/src/database/drizzle/0006_add_image_gen.sql b/src/database/drizzle/0006_add_image_gen.sql deleted file mode 100644 index 3147812..0000000 --- a/src/database/drizzle/0006_add_image_gen.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Add image generation support to bot_options --- Joel can generate images including NSFW content -ALTER TABLE bot_options ADD COLUMN image_gen_enabled INTEGER DEFAULT 0; diff --git a/src/database/drizzle/20260223215824_parched_albert_cleary/migration.sql b/src/database/drizzle/20260223215824_parched_albert_cleary/migration.sql new file mode 100644 index 0000000..36cba0c --- /dev/null +++ b/src/database/drizzle/20260223215824_parched_albert_cleary/migration.sql @@ -0,0 +1,84 @@ +CREATE TABLE `bot_options` ( + `guild_id` text PRIMARY KEY, + `active_personality_id` text, + `free_will_chance` integer DEFAULT 2, + `memory_chance` integer DEFAULT 30, + `mention_probability` integer DEFAULT 0, + `gif_search_enabled` integer DEFAULT 0, + `image_gen_enabled` integer DEFAULT 0, + `restricted_channel_id` text, + `updated_at` text DEFAULT (current_timestamp), + CONSTRAINT `fk_bot_options_guild_id_guilds_id_fk` FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) +); +--> statement-breakpoint +CREATE TABLE `guilds` ( + `id` text PRIMARY KEY, + `name` text +); +--> statement-breakpoint +CREATE TABLE `membership` ( + `user_id` text, + `guild_id` text, + CONSTRAINT `user_guild_unique` UNIQUE(`user_id`,`guild_id`) +); +--> statement-breakpoint +CREATE TABLE `memories` ( + `id` text PRIMARY KEY, + `content` text NOT NULL, + `category` text DEFAULT 'general', + `importance` integer DEFAULT 5, + `source_message_id` text, + `user_id` text, + `guild_id` text, + `created_at` text DEFAULT (current_timestamp), + `last_accessed_at` text, + `access_count` integer DEFAULT 0, + `embedding` text, + CONSTRAINT `fk_memories_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`), + CONSTRAINT `fk_memories_guild_id_guilds_id_fk` FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) +); +--> statement-breakpoint +CREATE TABLE `messages` ( + `id` text PRIMARY KEY, + `content` text, + `timestamp` text DEFAULT (current_timestamp), + `channel_id` text, + `user_id` text, + `guild_id` text, + CONSTRAINT `fk_messages_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`), + CONSTRAINT `fk_messages_guild_id_guilds_id_fk` FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) +); +--> statement-breakpoint +CREATE TABLE `personalities` ( + `id` text PRIMARY KEY, + `guild_id` text, + `name` text NOT NULL, + `system_prompt` text NOT NULL, + `created_at` text DEFAULT (current_timestamp), + `updated_at` text DEFAULT (current_timestamp), + CONSTRAINT `fk_personalities_guild_id_guilds_id_fk` FOREIGN KEY (`guild_id`) REFERENCES `guilds`(`id`) +); +--> statement-breakpoint +CREATE TABLE `users` ( + `id` text PRIMARY KEY, + `name` text, + `opt_out` integer +); +--> statement-breakpoint +CREATE TABLE `web_sessions` ( + `id` text PRIMARY KEY, + `user_id` text NOT NULL, + `access_token` text NOT NULL, + `refresh_token` text, + `expires_at` text NOT NULL, + `created_at` text DEFAULT (current_timestamp) +); +--> statement-breakpoint +CREATE INDEX `user_guild_idx` ON `membership` (`user_id`,`guild_id`);--> statement-breakpoint +CREATE INDEX `memory_user_idx` ON `memories` (`user_id`);--> statement-breakpoint +CREATE INDEX `memory_guild_idx` ON `memories` (`guild_id`);--> statement-breakpoint +CREATE INDEX `memory_user_importance_idx` ON `memories` (`user_id`,`importance`);--> statement-breakpoint +CREATE INDEX `memory_category_idx` ON `memories` (`category`);--> statement-breakpoint +CREATE INDEX `memory_user_category_idx` ON `memories` (`user_id`,`category`);--> statement-breakpoint +CREATE INDEX `channel_timestamp_idx` ON `messages` (`channel_id`,`timestamp`);--> statement-breakpoint +CREATE INDEX `personality_guild_idx` ON `personalities` (`guild_id`); \ No newline at end of file diff --git a/src/database/drizzle/20260223215824_parched_albert_cleary/snapshot.json b/src/database/drizzle/20260223215824_parched_albert_cleary/snapshot.json new file mode 100644 index 0000000..07398f1 --- /dev/null +++ b/src/database/drizzle/20260223215824_parched_albert_cleary/snapshot.json @@ -0,0 +1,784 @@ +{ + "version": "7", + "dialect": "sqlite", + "id": "be840e0c-ae30-4161-b3ff-0d07d7a2523f", + "prevIds": [ + "00000000-0000-0000-0000-000000000000" + ], + "ddl": [ + { + "name": "bot_options", + "entityType": "tables" + }, + { + "name": "guilds", + "entityType": "tables" + }, + { + "name": "membership", + "entityType": "tables" + }, + { + "name": "memories", + "entityType": "tables" + }, + { + "name": "messages", + "entityType": "tables" + }, + { + "name": "personalities", + "entityType": "tables" + }, + { + "name": "users", + "entityType": "tables" + }, + { + "name": "web_sessions", + "entityType": "tables" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "guild_id", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "active_personality_id", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "2", + "generated": null, + "name": "free_will_chance", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "30", + "generated": null, + "name": "memory_chance", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "mention_probability", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "gif_search_enabled", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "image_gen_enabled", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "restricted_channel_id", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "(current_timestamp)", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "bot_options" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "guilds" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "guilds" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "membership" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "guild_id", + "entityType": "columns", + "table": "membership" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "'general'", + "generated": null, + "name": "category", + "entityType": "columns", + "table": "memories" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "5", + "generated": null, + "name": "importance", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "source_message_id", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "guild_id", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "(current_timestamp)", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "last_accessed_at", + "entityType": "columns", + "table": "memories" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": "0", + "generated": null, + "name": "access_count", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "embedding", + "entityType": "columns", + "table": "memories" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "content", + "entityType": "columns", + "table": "messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "(current_timestamp)", + "generated": null, + "name": "timestamp", + "entityType": "columns", + "table": "messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "channel_id", + "entityType": "columns", + "table": "messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "guild_id", + "entityType": "columns", + "table": "messages" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "personalities" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "guild_id", + "entityType": "columns", + "table": "personalities" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "personalities" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "system_prompt", + "entityType": "columns", + "table": "personalities" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "(current_timestamp)", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "personalities" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "(current_timestamp)", + "generated": null, + "name": "updated_at", + "entityType": "columns", + "table": "personalities" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "name", + "entityType": "columns", + "table": "users" + }, + { + "type": "integer", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "opt_out", + "entityType": "columns", + "table": "users" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "id", + "entityType": "columns", + "table": "web_sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "user_id", + "entityType": "columns", + "table": "web_sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "access_token", + "entityType": "columns", + "table": "web_sessions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": null, + "generated": null, + "name": "refresh_token", + "entityType": "columns", + "table": "web_sessions" + }, + { + "type": "text", + "notNull": true, + "autoincrement": false, + "default": null, + "generated": null, + "name": "expires_at", + "entityType": "columns", + "table": "web_sessions" + }, + { + "type": "text", + "notNull": false, + "autoincrement": false, + "default": "(current_timestamp)", + "generated": null, + "name": "created_at", + "entityType": "columns", + "table": "web_sessions" + }, + { + "columns": [ + "guild_id" + ], + "tableTo": "guilds", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_bot_options_guild_id_guilds_id_fk", + "entityType": "fks", + "table": "bot_options" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_memories_user_id_users_id_fk", + "entityType": "fks", + "table": "memories" + }, + { + "columns": [ + "guild_id" + ], + "tableTo": "guilds", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_memories_guild_id_guilds_id_fk", + "entityType": "fks", + "table": "memories" + }, + { + "columns": [ + "user_id" + ], + "tableTo": "users", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_messages_user_id_users_id_fk", + "entityType": "fks", + "table": "messages" + }, + { + "columns": [ + "guild_id" + ], + "tableTo": "guilds", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_messages_guild_id_guilds_id_fk", + "entityType": "fks", + "table": "messages" + }, + { + "columns": [ + "guild_id" + ], + "tableTo": "guilds", + "columnsTo": [ + "id" + ], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "nameExplicit": false, + "name": "fk_personalities_guild_id_guilds_id_fk", + "entityType": "fks", + "table": "personalities" + }, + { + "columns": [ + "guild_id" + ], + "nameExplicit": false, + "name": "bot_options_pk", + "table": "bot_options", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "guilds_pk", + "table": "guilds", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "memories_pk", + "table": "memories", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "messages_pk", + "table": "messages", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "personalities_pk", + "table": "personalities", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "users_pk", + "table": "users", + "entityType": "pks" + }, + { + "columns": [ + "id" + ], + "nameExplicit": false, + "name": "web_sessions_pk", + "table": "web_sessions", + "entityType": "pks" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "guild_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "user_guild_idx", + "entityType": "indexes", + "table": "membership" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "memory_user_idx", + "entityType": "indexes", + "table": "memories" + }, + { + "columns": [ + { + "value": "guild_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "memory_guild_idx", + "entityType": "indexes", + "table": "memories" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "importance", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "memory_user_importance_idx", + "entityType": "indexes", + "table": "memories" + }, + { + "columns": [ + { + "value": "category", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "memory_category_idx", + "entityType": "indexes", + "table": "memories" + }, + { + "columns": [ + { + "value": "user_id", + "isExpression": false + }, + { + "value": "category", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "memory_user_category_idx", + "entityType": "indexes", + "table": "memories" + }, + { + "columns": [ + { + "value": "channel_id", + "isExpression": false + }, + { + "value": "timestamp", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "channel_timestamp_idx", + "entityType": "indexes", + "table": "messages" + }, + { + "columns": [ + { + "value": "guild_id", + "isExpression": false + } + ], + "isUnique": false, + "where": null, + "origin": "manual", + "name": "personality_guild_idx", + "entityType": "indexes", + "table": "personalities" + }, + { + "columns": [ + "user_id", + "guild_id" + ], + "nameExplicit": true, + "name": "user_guild_unique", + "entityType": "uniques", + "table": "membership" + } + ], + "renames": [] +} \ No newline at end of file diff --git a/src/database/drizzle/meta/0000_snapshot.json b/src/database/drizzle/meta/0000_snapshot.json deleted file mode 100644 index 0007c27..0000000 --- a/src/database/drizzle/meta/0000_snapshot.json +++ /dev/null @@ -1,281 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "tables": { - "guilds": { - "name": "guilds", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "membership": { - "name": "membership", - "columns": { - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_guild_idx": { - "name": "user_guild_idx", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": false - }, - "user_guild_unique": { - "name": "user_guild_unique", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "memories": { - "name": "memories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_timestamp_idx": { - "name": "user_timestamp_idx", - "columns": [ - "user_id", - "timestamp" - ], - "isUnique": false - } - }, - "foreignKeys": { - "memories_user_id_users_id_fk": { - "name": "memories_user_id_users_id_fk", - "tableFrom": "memories", - "columnsFrom": [ - "user_id" - ], - "tableTo": "users", - "columnsTo": [ - "id" - ], - "onUpdate": "no action", - "onDelete": "no action" - }, - "memories_guild_id_guilds_id_fk": { - "name": "memories_guild_id_guilds_id_fk", - "tableFrom": "memories", - "columnsFrom": [ - "guild_id" - ], - "tableTo": "guilds", - "columnsTo": [ - "id" - ], - "onUpdate": "no action", - "onDelete": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messages": { - "name": "messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "channel_id": { - "name": "channel_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "channel_timestamp_idx": { - "name": "channel_timestamp_idx", - "columns": [ - "channel_id", - "timestamp" - ], - "isUnique": false - } - }, - "foreignKeys": { - "messages_user_id_users_id_fk": { - "name": "messages_user_id_users_id_fk", - "tableFrom": "messages", - "columnsFrom": [ - "user_id" - ], - "tableTo": "users", - "columnsTo": [ - "id" - ], - "onUpdate": "no action", - "onDelete": "no action" - }, - "messages_guild_id_guilds_id_fk": { - "name": "messages_guild_id_guilds_id_fk", - "tableFrom": "messages", - "columnsFrom": [ - "guild_id" - ], - "tableTo": "guilds", - "columnsTo": [ - "id" - ], - "onUpdate": "no action", - "onDelete": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "opt_out": { - "name": "opt_out", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "enums": {}, - "_meta": { - "tables": {}, - "columns": {} - }, - "id": "b6ea108a-adf7-4bb9-b407-5903f0798578", - "prevId": "00000000-0000-0000-0000-000000000000", - "views": {} -} \ No newline at end of file diff --git a/src/database/drizzle/meta/0001_snapshot.json b/src/database/drizzle/meta/0001_snapshot.json deleted file mode 100644 index 40d6cf2..0000000 --- a/src/database/drizzle/meta/0001_snapshot.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "72ff388b-edab-47a7-b92a-b2b895992b7e", - "prevId": "b6ea108a-adf7-4bb9-b407-5903f0798578", - "tables": { - "guilds": { - "name": "guilds", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "membership": { - "name": "membership", - "columns": { - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_guild_idx": { - "name": "user_guild_idx", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": false - }, - "user_guild_unique": { - "name": "user_guild_unique", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "memories": { - "name": "memories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_timestamp_idx": { - "name": "user_timestamp_idx", - "columns": [ - "user_id", - "timestamp" - ], - "isUnique": false - } - }, - "foreignKeys": { - "memories_user_id_users_id_fk": { - "name": "memories_user_id_users_id_fk", - "tableFrom": "memories", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "memories_guild_id_guilds_id_fk": { - "name": "memories_guild_id_guilds_id_fk", - "tableFrom": "memories", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messages": { - "name": "messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "channel_id": { - "name": "channel_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "channel_timestamp_idx": { - "name": "channel_timestamp_idx", - "columns": [ - "channel_id", - "timestamp" - ], - "isUnique": false - } - }, - "foreignKeys": { - "messages_user_id_users_id_fk": { - "name": "messages_user_id_users_id_fk", - "tableFrom": "messages", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "messages_guild_id_guilds_id_fk": { - "name": "messages_guild_id_guilds_id_fk", - "tableFrom": "messages", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "opt_out": { - "name": "opt_out", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": {} - } -} \ No newline at end of file diff --git a/src/database/drizzle/meta/0002_snapshot.json b/src/database/drizzle/meta/0002_snapshot.json deleted file mode 100644 index 119c57f..0000000 --- a/src/database/drizzle/meta/0002_snapshot.json +++ /dev/null @@ -1,484 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "076a0cb6-fb7d-47b0-ad34-2c635b1533c2", - "prevId": "72ff388b-edab-47a7-b92a-b2b895992b7e", - "tables": { - "bot_options": { - "name": "bot_options", - "columns": { - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "active_personality_id": { - "name": "active_personality_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "free_will_chance": { - "name": "free_will_chance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 2 - }, - "memory_chance": { - "name": "memory_chance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 30 - }, - "mention_probability": { - "name": "mention_probability", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": {}, - "foreignKeys": { - "bot_options_guild_id_guilds_id_fk": { - "name": "bot_options_guild_id_guilds_id_fk", - "tableFrom": "bot_options", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "guilds": { - "name": "guilds", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "membership": { - "name": "membership", - "columns": { - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_guild_idx": { - "name": "user_guild_idx", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": false - }, - "user_guild_unique": { - "name": "user_guild_unique", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "memories": { - "name": "memories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_timestamp_idx": { - "name": "user_timestamp_idx", - "columns": [ - "user_id", - "timestamp" - ], - "isUnique": false - } - }, - "foreignKeys": { - "memories_user_id_users_id_fk": { - "name": "memories_user_id_users_id_fk", - "tableFrom": "memories", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "memories_guild_id_guilds_id_fk": { - "name": "memories_guild_id_guilds_id_fk", - "tableFrom": "memories", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messages": { - "name": "messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "channel_id": { - "name": "channel_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "channel_timestamp_idx": { - "name": "channel_timestamp_idx", - "columns": [ - "channel_id", - "timestamp" - ], - "isUnique": false - } - }, - "foreignKeys": { - "messages_user_id_users_id_fk": { - "name": "messages_user_id_users_id_fk", - "tableFrom": "messages", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "messages_guild_id_guilds_id_fk": { - "name": "messages_guild_id_guilds_id_fk", - "tableFrom": "messages", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "personalities": { - "name": "personalities", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "system_prompt": { - "name": "system_prompt", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "updated_at": { - "name": "updated_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": { - "personality_guild_idx": { - "name": "personality_guild_idx", - "columns": [ - "guild_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "personalities_guild_id_guilds_id_fk": { - "name": "personalities_guild_id_guilds_id_fk", - "tableFrom": "personalities", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "opt_out": { - "name": "opt_out", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "web_sessions": { - "name": "web_sessions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": {} - } -} \ No newline at end of file diff --git a/src/database/drizzle/meta/0003_snapshot.json b/src/database/drizzle/meta/0003_snapshot.json deleted file mode 100644 index 1ca9c73..0000000 --- a/src/database/drizzle/meta/0003_snapshot.json +++ /dev/null @@ -1,560 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "e2827c5c-cc3c-451c-bc4f-5d472d09d7df", - "prevId": "076a0cb6-fb7d-47b0-ad34-2c635b1533c2", - "tables": { - "bot_options": { - "name": "bot_options", - "columns": { - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "active_personality_id": { - "name": "active_personality_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "free_will_chance": { - "name": "free_will_chance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 2 - }, - "memory_chance": { - "name": "memory_chance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 30 - }, - "mention_probability": { - "name": "mention_probability", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": {}, - "foreignKeys": { - "bot_options_guild_id_guilds_id_fk": { - "name": "bot_options_guild_id_guilds_id_fk", - "tableFrom": "bot_options", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "guilds": { - "name": "guilds", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "membership": { - "name": "membership", - "columns": { - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_guild_idx": { - "name": "user_guild_idx", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": false - }, - "user_guild_unique": { - "name": "user_guild_unique", - "columns": [ - "user_id", - "guild_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "memories": { - "name": "memories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "'general'" - }, - "importance": { - "name": "importance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 5 - }, - "source_message_id": { - "name": "source_message_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "last_accessed_at": { - "name": "last_accessed_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_count": { - "name": "access_count", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - }, - "embedding": { - "name": "embedding", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "memory_user_idx": { - "name": "memory_user_idx", - "columns": [ - "user_id" - ], - "isUnique": false - }, - "memory_guild_idx": { - "name": "memory_guild_idx", - "columns": [ - "guild_id" - ], - "isUnique": false - }, - "memory_user_importance_idx": { - "name": "memory_user_importance_idx", - "columns": [ - "user_id", - "importance" - ], - "isUnique": false - }, - "memory_category_idx": { - "name": "memory_category_idx", - "columns": [ - "category" - ], - "isUnique": false - }, - "memory_user_category_idx": { - "name": "memory_user_category_idx", - "columns": [ - "user_id", - "category" - ], - "isUnique": false - } - }, - "foreignKeys": { - "memories_user_id_users_id_fk": { - "name": "memories_user_id_users_id_fk", - "tableFrom": "memories", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "memories_guild_id_guilds_id_fk": { - "name": "memories_guild_id_guilds_id_fk", - "tableFrom": "memories", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messages": { - "name": "messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "channel_id": { - "name": "channel_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "channel_timestamp_idx": { - "name": "channel_timestamp_idx", - "columns": [ - "channel_id", - "timestamp" - ], - "isUnique": false - } - }, - "foreignKeys": { - "messages_user_id_users_id_fk": { - "name": "messages_user_id_users_id_fk", - "tableFrom": "messages", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "messages_guild_id_guilds_id_fk": { - "name": "messages_guild_id_guilds_id_fk", - "tableFrom": "messages", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "personalities": { - "name": "personalities", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "system_prompt": { - "name": "system_prompt", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "updated_at": { - "name": "updated_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": { - "personality_guild_idx": { - "name": "personality_guild_idx", - "columns": [ - "guild_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "personalities_guild_id_guilds_id_fk": { - "name": "personalities_guild_id_guilds_id_fk", - "tableFrom": "personalities", - "tableTo": "guilds", - "columnsFrom": [ - "guild_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "opt_out": { - "name": "opt_out", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "web_sessions": { - "name": "web_sessions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": { - "\"memories\".\"timestamp\"": "\"memories\".\"created_at\"" - } - }, - "internal": { - "indexes": {} - } -} \ No newline at end of file diff --git a/src/database/drizzle/meta/0004_snapshot.json b/src/database/drizzle/meta/0004_snapshot.json deleted file mode 100644 index 5033f6f..0000000 --- a/src/database/drizzle/meta/0004_snapshot.json +++ /dev/null @@ -1,519 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "f3938d6d-aa4e-461e-bc5f-6e583e0eacf0", - "prevId": "e2827c5c-cc3c-451c-bc4f-5d472d09d7df", - "tables": { - "bot_options": { - "name": "bot_options", - "columns": { - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "active_personality_id": { - "name": "active_personality_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "free_will_chance": { - "name": "free_will_chance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 2 - }, - "memory_chance": { - "name": "memory_chance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 30 - }, - "mention_probability": { - "name": "mention_probability", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - }, - "gif_search_enabled": { - "name": "gif_search_enabled", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": {}, - "foreignKeys": { - "bot_options_guild_id_guilds_id_fk": { - "name": "bot_options_guild_id_guilds_id_fk", - "tableFrom": "bot_options", - "tableTo": "guilds", - "columnsFrom": ["guild_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "guilds": { - "name": "guilds", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "membership": { - "name": "membership", - "columns": { - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "user_guild_idx": { - "name": "user_guild_idx", - "columns": ["user_id", "guild_id"], - "isUnique": false - }, - "user_guild_unique": { - "name": "user_guild_unique", - "columns": ["user_id", "guild_id"], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "memories": { - "name": "memories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "'general'" - }, - "importance": { - "name": "importance", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 5 - }, - "source_message_id": { - "name": "source_message_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "last_accessed_at": { - "name": "last_accessed_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_count": { - "name": "access_count", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 0 - }, - "embedding": { - "name": "embedding", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "memory_user_idx": { - "name": "memory_user_idx", - "columns": ["user_id"], - "isUnique": false - }, - "memory_guild_idx": { - "name": "memory_guild_idx", - "columns": ["guild_id"], - "isUnique": false - }, - "memory_user_importance_idx": { - "name": "memory_user_importance_idx", - "columns": ["user_id", "importance"], - "isUnique": false - }, - "memory_category_idx": { - "name": "memory_category_idx", - "columns": ["category"], - "isUnique": false - }, - "memory_user_category_idx": { - "name": "memory_user_category_idx", - "columns": ["user_id", "category"], - "isUnique": false - } - }, - "foreignKeys": { - "memories_user_id_users_id_fk": { - "name": "memories_user_id_users_id_fk", - "tableFrom": "memories", - "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "memories_guild_id_guilds_id_fk": { - "name": "memories_guild_id_guilds_id_fk", - "tableFrom": "memories", - "tableTo": "guilds", - "columnsFrom": ["guild_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messages": { - "name": "messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timestamp": { - "name": "timestamp", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "channel_id": { - "name": "channel_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "channel_timestamp_idx": { - "name": "channel_timestamp_idx", - "columns": ["channel_id", "timestamp"], - "isUnique": false - } - }, - "foreignKeys": { - "messages_user_id_users_id_fk": { - "name": "messages_user_id_users_id_fk", - "tableFrom": "messages", - "tableTo": "users", - "columnsFrom": ["user_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - }, - "messages_guild_id_guilds_id_fk": { - "name": "messages_guild_id_guilds_id_fk", - "tableFrom": "messages", - "tableTo": "guilds", - "columnsFrom": ["guild_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "personalities": { - "name": "personalities", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "guild_id": { - "name": "guild_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "system_prompt": { - "name": "system_prompt", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - }, - "updated_at": { - "name": "updated_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": { - "personality_guild_idx": { - "name": "personality_guild_idx", - "columns": ["guild_id"], - "isUnique": false - } - }, - "foreignKeys": { - "personalities_guild_id_guilds_id_fk": { - "name": "personalities_guild_id_guilds_id_fk", - "tableFrom": "personalities", - "tableTo": "guilds", - "columnsFrom": ["guild_id"], - "columnsTo": ["id"], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "opt_out": { - "name": "opt_out", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "web_sessions": { - "name": "web_sessions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "access_token": { - "name": "access_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token": { - "name": "refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": "(current_timestamp)" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": {} - } -} diff --git a/src/database/drizzle/meta/_journal.json b/src/database/drizzle/meta/_journal.json deleted file mode 100644 index 8201743..0000000 --- a/src/database/drizzle/meta/_journal.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "version": "5", - "dialect": "sqlite", - "entries": [ - { - "idx": 0, - "version": "5", - "when": 1714908216508, - "tag": "0000_fast_lester", - "breakpoints": true - }, - { - "idx": 1, - "version": "6", - "when": 1769598308518, - "tag": "0001_rich_star_brand", - "breakpoints": true - }, - { - "idx": 2, - "version": "6", - "when": 1769961851484, - "tag": "0002_robust_saracen", - "breakpoints": true - }, - { - "idx": 3, - "version": "6", - "when": 1769964737832, - "tag": "0003_silky_sauron", - "breakpoints": true - }, - { - "idx": 4, - "version": "6", - "when": 1770048000000, - "tag": "0004_add_gif_search", - "breakpoints": true - }, - { - "idx": 5, - "version": "6", - "when": 1770134400000, - "tag": "0005_add_channel_restriction", - "breakpoints": true - }, - { - "idx": 6, - "version": "6", - "when": 1770220800000, - "tag": "0006_add_image_gen", - "breakpoints": true - } - ] -} diff --git a/src/database/migrate.ts b/src/database/migrate.ts index 7007aea..9f22621 100644 --- a/src/database/migrate.ts +++ b/src/database/migrate.ts @@ -9,7 +9,7 @@ import { createLogger } from "../core/logger"; const logger = createLogger("Database:Migrate"); -async function runMigrations(): Promise { +export async function runMigrations(): Promise { logger.info("Running database migrations..."); try { @@ -23,4 +23,6 @@ async function runMigrations(): Promise { } } -runMigrations(); +if (import.meta.main) { + runMigrations(); +} diff --git a/src/index.ts b/src/index.ts index 9039773..e4edb47 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,7 @@ import { createLogger } from "./core/logger"; import { registerEvents } from "./events"; import { stopSpontaneousMentionsCron } from "./features/joel"; import { startWebServer } from "./web"; +import { runMigrations } from "./database/migrate"; const logger = createLogger("Main"); @@ -43,6 +44,9 @@ async function main(): Promise { logger.info("Starting Joel bot..."); try { + // Run database migrations + await runMigrations(); + await client.login(config.discord.token); // Start web server after bot is logged in