diff --git a/bun.lock b/bun.lock index 16fc0e9d..5162c550 100644 --- a/bun.lock +++ b/bun.lock @@ -107,7 +107,6 @@ "devDependencies": { "@cloudflare/vite-plugin": "^1.11.4", "@cloudflare/vitest-pool-workers": "^0.8.55", - "@cloudflare/workers-types": "^4.20250810.0", "@eslint/js": "^9.25.1", "@tailwindcss/typography": "^0.5.16", "@tailwindcss/vite": "^4.1.11", @@ -261,7 +260,7 @@ "@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20250816.0", "", { "os": "win32", "cpu": "x64" }, "sha512-0lqClj2UMhFa8tCBiiX7Zhd5Bjp0V+X8oNBG6V6WsR9p9/HlIHAGgwRAM7aYkyG+8KC8xlbC89O2AXUXLpHx0g=="], - "@cloudflare/workers-types": ["@cloudflare/workers-types@4.20250822.0", "", {}, "sha512-SR5nxiclSEXS/lVwcfFCS/h7L99VWg0wa2B2CavdTAOwGznwTNcd3vmrrer3LwkqhAUQnDc2aZg3HbRvoh4LYw=="], + "@cloudflare/workers-types": ["@cloudflare/workers-types@4.20250829.0", "", {}, "sha512-BptuGoad/zqSj4S3PjFlC1bhVnbSpExjaoZ2KXLvvHPDgPNtuKTCJyaAAibEd3J1vev2bKnjunVin2mrt9hRFg=="], "@cspotcode/source-map-support": ["@cspotcode/source-map-support@0.8.1", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="], diff --git a/migrations/0010_neat_firedrake.sql b/migrations/0010_neat_firedrake.sql new file mode 100644 index 00000000..5461a7e8 --- /dev/null +++ b/migrations/0010_neat_firedrake.sql @@ -0,0 +1,21 @@ +CREATE TABLE `github_integrations` ( + `id` text PRIMARY KEY NOT NULL, + `github_user_id` text NOT NULL, + `github_username` text NOT NULL, + `access_token_hash` text NOT NULL, + `refresh_token_hash` text, + `user_id` text, + `team_id` text, + `default_organization` text, + `is_active` integer DEFAULT true, + `scopes` text DEFAULT '[]', + `last_validated` integer, + `created_at` integer DEFAULT CURRENT_TIMESTAMP, + `updated_at` integer DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `github_integrations_user_idx` ON `github_integrations` (`user_id`);--> statement-breakpoint +CREATE INDEX `github_integrations_team_idx` ON `github_integrations` (`team_id`);--> statement-breakpoint +CREATE INDEX `github_integrations_github_user_idx` ON `github_integrations` (`github_user_id`); \ No newline at end of file diff --git a/migrations/0011_even_drax.sql b/migrations/0011_even_drax.sql new file mode 100644 index 00000000..04d7bc53 --- /dev/null +++ b/migrations/0011_even_drax.sql @@ -0,0 +1 @@ +DROP TABLE `github_integrations`; \ No newline at end of file diff --git a/migrations/meta/0010_snapshot.json b/migrations/meta/0010_snapshot.json new file mode 100644 index 00000000..11515497 --- /dev/null +++ b/migrations/meta/0010_snapshot.json @@ -0,0 +1,3868 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "7d8f06c8-fede-4b2e-a217-bd9ff5913b28", + "prevId": "2c5ee5a1-e51c-4e3c-a49e-a48d011360f6", + "tables": { + "api_keys": { + "name": "api_keys", + "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 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "last_used": { + "name": "last_used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "request_count": { + "name": "request_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "api_keys_key_hash_unique": { + "name": "api_keys_key_hash_unique", + "columns": [ + "key_hash" + ], + "isUnique": true + }, + "api_keys_user_id_idx": { + "name": "api_keys_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "api_keys_key_hash_idx": { + "name": "api_keys_key_hash_idx", + "columns": [ + "key_hash" + ], + "isUnique": false + }, + "api_keys_is_active_idx": { + "name": "api_keys_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + }, + "api_keys_expires_at_idx": { + "name": "api_keys_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "api_keys_user_id_users_id_fk": { + "name": "api_keys_user_id_users_id_fk", + "tableFrom": "api_keys", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_categories": { + "name": "app_categories", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "category_name": { + "name": "category_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_categories_app_category_idx": { + "name": "app_categories_app_category_idx", + "columns": [ + "app_id", + "category_name" + ], + "isUnique": true + }, + "app_categories_category_name_idx": { + "name": "app_categories_category_name_idx", + "columns": [ + "category_name" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_categories_app_id_apps_id_fk": { + "name": "app_categories_app_id_apps_id_fk", + "tableFrom": "app_categories", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_comments": { + "name": "app_comments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_edited": { + "name": "is_edited", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_deleted": { + "name": "is_deleted", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_comments_app_idx": { + "name": "app_comments_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + }, + "app_comments_user_idx": { + "name": "app_comments_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "app_comments_parent_idx": { + "name": "app_comments_parent_idx", + "columns": [ + "parent_comment_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_comments_app_id_apps_id_fk": { + "name": "app_comments_app_id_apps_id_fk", + "tableFrom": "app_comments", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "app_comments_user_id_users_id_fk": { + "name": "app_comments_user_id_users_id_fk", + "tableFrom": "app_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_likes": { + "name": "app_likes", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reaction_type": { + "name": "reaction_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'like'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_likes_app_user_idx": { + "name": "app_likes_app_user_idx", + "columns": [ + "app_id", + "user_id" + ], + "isUnique": true + }, + "app_likes_user_idx": { + "name": "app_likes_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_likes_app_id_apps_id_fk": { + "name": "app_likes_app_id_apps_id_fk", + "tableFrom": "app_likes", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "app_likes_user_id_users_id_fk": { + "name": "app_likes_user_id_users_id_fk", + "tableFrom": "app_likes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_tags": { + "name": "app_tags", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tag_name": { + "name": "tag_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_tags_app_tag_idx": { + "name": "app_tags_app_tag_idx", + "columns": [ + "app_id", + "tag_name" + ], + "isUnique": true + }, + "app_tags_tag_name_idx": { + "name": "app_tags_tag_name_idx", + "columns": [ + "tag_name" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_tags_app_id_apps_id_fk": { + "name": "app_tags_app_id_apps_id_fk", + "tableFrom": "app_tags", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_views": { + "name": "app_views", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_address_hash": { + "name": "ip_address_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "referrer": { + "name": "referrer", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "device_type": { + "name": "device_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "viewed_at": { + "name": "viewed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "duration_seconds": { + "name": "duration_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "app_views_app_idx": { + "name": "app_views_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + }, + "app_views_user_idx": { + "name": "app_views_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "app_views_viewed_at_idx": { + "name": "app_views_viewed_at_idx", + "columns": [ + "viewed_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_views_app_id_apps_id_fk": { + "name": "app_views_app_id_apps_id_fk", + "tableFrom": "app_views", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "app_views_user_id_users_id_fk": { + "name": "app_views_user_id_users_id_fk", + "tableFrom": "app_views", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "apps": { + "name": "apps", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "icon_url": { + "name": "icon_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "original_prompt": { + "name": "original_prompt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "final_prompt": { + "name": "final_prompt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "blueprint": { + "name": "blueprint", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "framework": { + "name": "framework", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'private'" + }, + "board_id": { + "name": "board_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'generating'" + }, + "deployment_url": { + "name": "deployment_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cloudflare_account_id": { + "name": "cloudflare_account_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deployment_status": { + "name": "deployment_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'none'" + }, + "deployment_metadata": { + "name": "deployment_metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'{}'" + }, + "github_repository_url": { + "name": "github_repository_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "github_repository_visibility": { + "name": "github_repository_visibility", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_archived": { + "name": "is_archived", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_featured": { + "name": "is_featured", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 1 + }, + "parent_app_id": { + "name": "parent_app_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "screenshot_url": { + "name": "screenshot_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "screenshot_captured_at": { + "name": "screenshot_captured_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "last_deployed_at": { + "name": "last_deployed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "apps_user_idx": { + "name": "apps_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "apps_team_idx": { + "name": "apps_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "apps_board_idx": { + "name": "apps_board_idx", + "columns": [ + "board_id" + ], + "isUnique": false + }, + "apps_status_idx": { + "name": "apps_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "apps_visibility_idx": { + "name": "apps_visibility_idx", + "columns": [ + "visibility" + ], + "isUnique": false + }, + "apps_slug_idx": { + "name": "apps_slug_idx", + "columns": [ + "slug" + ], + "isUnique": false + }, + "apps_session_token_idx": { + "name": "apps_session_token_idx", + "columns": [ + "session_token" + ], + "isUnique": false + }, + "apps_parent_app_idx": { + "name": "apps_parent_app_idx", + "columns": [ + "parent_app_id" + ], + "isUnique": false + }, + "apps_search_idx": { + "name": "apps_search_idx", + "columns": [ + "title", + "description" + ], + "isUnique": false + }, + "apps_framework_status_idx": { + "name": "apps_framework_status_idx", + "columns": [ + "framework", + "status" + ], + "isUnique": false + }, + "apps_visibility_status_idx": { + "name": "apps_visibility_status_idx", + "columns": [ + "visibility", + "status" + ], + "isUnique": false + }, + "apps_created_at_idx": { + "name": "apps_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "apps_updated_at_idx": { + "name": "apps_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "apps_user_id_users_id_fk": { + "name": "apps_user_id_users_id_fk", + "tableFrom": "apps", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "apps_team_id_teams_id_fk": { + "name": "apps_team_id_teams_id_fk", + "tableFrom": "apps", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "apps_board_id_boards_id_fk": { + "name": "apps_board_id_boards_id_fk", + "tableFrom": "apps", + "tableTo": "boards", + "columnsFrom": [ + "board_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "audit_logs": { + "name": "audit_logs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "old_values": { + "name": "old_values", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "new_values": { + "name": "new_values", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "audit_logs_user_idx": { + "name": "audit_logs_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "audit_logs_entity_idx": { + "name": "audit_logs_entity_idx", + "columns": [ + "entity_type", + "entity_id" + ], + "isUnique": false + }, + "audit_logs_created_at_idx": { + "name": "audit_logs_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "audit_logs_user_id_users_id_fk": { + "name": "audit_logs_user_id_users_id_fk", + "tableFrom": "audit_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "auth_attempts": { + "name": "auth_attempts", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "attempt_type": { + "name": "attempt_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "success": { + "name": "success", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attempted_at": { + "name": "attempted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "auth_attempts_lookup_idx": { + "name": "auth_attempts_lookup_idx", + "columns": [ + "identifier", + "attempted_at" + ], + "isUnique": false + }, + "auth_attempts_ip_idx": { + "name": "auth_attempts_ip_idx", + "columns": [ + "ip_address", + "attempted_at" + ], + "isUnique": false + }, + "auth_attempts_success_idx": { + "name": "auth_attempts_success_idx", + "columns": [ + "success", + "attempted_at" + ], + "isUnique": false + }, + "auth_attempts_type_idx": { + "name": "auth_attempts_type_idx", + "columns": [ + "attempt_type", + "attempted_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "board_members": { + "name": "board_members", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "board_id": { + "name": "board_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'member'" + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "is_banned": { + "name": "is_banned", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "banned_at": { + "name": "banned_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned_reason": { + "name": "banned_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "joined_at": { + "name": "joined_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "board_members_board_user_idx": { + "name": "board_members_board_user_idx", + "columns": [ + "board_id", + "user_id" + ], + "isUnique": true + }, + "board_members_user_idx": { + "name": "board_members_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "board_members_board_id_boards_id_fk": { + "name": "board_members_board_id_boards_id_fk", + "tableFrom": "board_members", + "tableTo": "boards", + "columnsFrom": [ + "board_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "board_members_user_id_users_id_fk": { + "name": "board_members_user_id_users_id_fk", + "tableFrom": "board_members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "boards": { + "name": "boards", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "icon_url": { + "name": "icon_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banner_url": { + "name": "banner_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'public'" + }, + "allow_submissions": { + "name": "allow_submissions", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "require_approval": { + "name": "require_approval", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "rules": { + "name": "rules", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "guidelines": { + "name": "guidelines", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "boards_slug_unique": { + "name": "boards_slug_unique", + "columns": [ + "slug" + ], + "isUnique": true + }, + "boards_slug_idx": { + "name": "boards_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "boards_owner_idx": { + "name": "boards_owner_idx", + "columns": [ + "owner_id" + ], + "isUnique": false + }, + "boards_team_idx": { + "name": "boards_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "boards_visibility_idx": { + "name": "boards_visibility_idx", + "columns": [ + "visibility" + ], + "isUnique": false + } + }, + "foreignKeys": { + "boards_owner_id_users_id_fk": { + "name": "boards_owner_id_users_id_fk", + "tableFrom": "boards", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "boards_team_id_teams_id_fk": { + "name": "boards_team_id_teams_id_fk", + "tableFrom": "boards", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "cloudflare_accounts": { + "name": "cloudflare_accounts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "api_token_hash": { + "name": "api_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_default": { + "name": "is_default", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "capabilities": { + "name": "capabilities", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "last_validated": { + "name": "last_validated", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "validation_status": { + "name": "validation_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "cf_accounts_user_idx": { + "name": "cf_accounts_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "cf_accounts_team_idx": { + "name": "cf_accounts_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "cf_accounts_account_id_idx": { + "name": "cf_accounts_account_id_idx", + "columns": [ + "account_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "cloudflare_accounts_user_id_users_id_fk": { + "name": "cloudflare_accounts_user_id_users_id_fk", + "tableFrom": "cloudflare_accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cloudflare_accounts_team_id_teams_id_fk": { + "name": "cloudflare_accounts_team_id_teams_id_fk", + "tableFrom": "cloudflare_accounts", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "comment_likes": { + "name": "comment_likes", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "comment_id": { + "name": "comment_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reaction_type": { + "name": "reaction_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'like'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "comment_likes_comment_user_idx": { + "name": "comment_likes_comment_user_idx", + "columns": [ + "comment_id", + "user_id" + ], + "isUnique": true + }, + "comment_likes_user_idx": { + "name": "comment_likes_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "comment_likes_comment_idx": { + "name": "comment_likes_comment_idx", + "columns": [ + "comment_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "comment_likes_comment_id_app_comments_id_fk": { + "name": "comment_likes_comment_id_app_comments_id_fk", + "tableFrom": "comment_likes", + "tableTo": "app_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "comment_likes_user_id_users_id_fk": { + "name": "comment_likes_user_id_users_id_fk", + "tableFrom": "comment_likes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "email_verification_tokens": { + "name": "email_verification_tokens", + "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 + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "used": { + "name": "used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "email_verification_tokens_token_hash_unique": { + "name": "email_verification_tokens_token_hash_unique", + "columns": [ + "token_hash" + ], + "isUnique": true + }, + "email_verification_tokens_lookup_idx": { + "name": "email_verification_tokens_lookup_idx", + "columns": [ + "token_hash" + ], + "isUnique": false + }, + "email_verification_tokens_expiry_idx": { + "name": "email_verification_tokens_expiry_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "email_verification_tokens_user_id_users_id_fk": { + "name": "email_verification_tokens_user_id_users_id_fk", + "tableFrom": "email_verification_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "favorites": { + "name": "favorites", + "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 + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "favorites_user_app_idx": { + "name": "favorites_user_app_idx", + "columns": [ + "user_id", + "app_id" + ], + "isUnique": true + }, + "favorites_user_idx": { + "name": "favorites_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "favorites_app_idx": { + "name": "favorites_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "favorites_user_id_users_id_fk": { + "name": "favorites_user_id_users_id_fk", + "tableFrom": "favorites", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "favorites_app_id_apps_id_fk": { + "name": "favorites_app_id_apps_id_fk", + "tableFrom": "favorites", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "github_integrations": { + "name": "github_integrations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "github_user_id": { + "name": "github_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "access_token_hash": { + "name": "access_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "refresh_token_hash": { + "name": "refresh_token_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "default_organization": { + "name": "default_organization", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "last_validated": { + "name": "last_validated", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "github_integrations_user_idx": { + "name": "github_integrations_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "github_integrations_team_idx": { + "name": "github_integrations_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "github_integrations_github_user_idx": { + "name": "github_integrations_github_user_idx", + "columns": [ + "github_user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "github_integrations_user_id_users_id_fk": { + "name": "github_integrations_user_id_users_id_fk", + "tableFrom": "github_integrations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "github_integrations_team_id_teams_id_fk": { + "name": "github_integrations_team_id_teams_id_fk", + "tableFrom": "github_integrations", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "oauth_states": { + "name": "oauth_states", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "redirect_uri": { + "name": "redirect_uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "code_verifier": { + "name": "code_verifier", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "nonce": { + "name": "nonce", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_used": { + "name": "is_used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "oauth_states_state_unique": { + "name": "oauth_states_state_unique", + "columns": [ + "state" + ], + "isUnique": true + }, + "oauth_states_state_idx": { + "name": "oauth_states_state_idx", + "columns": [ + "state" + ], + "isUnique": true + }, + "oauth_states_expires_at_idx": { + "name": "oauth_states_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "oauth_states_user_id_users_id_fk": { + "name": "oauth_states_user_id_users_id_fk", + "tableFrom": "oauth_states", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "password_reset_tokens": { + "name": "password_reset_tokens", + "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 + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "used": { + "name": "used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "password_reset_tokens_token_hash_unique": { + "name": "password_reset_tokens_token_hash_unique", + "columns": [ + "token_hash" + ], + "isUnique": true + }, + "password_reset_tokens_lookup_idx": { + "name": "password_reset_tokens_lookup_idx", + "columns": [ + "token_hash" + ], + "isUnique": false + }, + "password_reset_tokens_expiry_idx": { + "name": "password_reset_tokens_expiry_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "password_reset_tokens_user_id_users_id_fk": { + "name": "password_reset_tokens_user_id_users_id_fk", + "tableFrom": "password_reset_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "sessions": { + "name": "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 + }, + "device_info": { + "name": "device_info", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_revoked": { + "name": "is_revoked", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "revoked_reason": { + "name": "revoked_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "access_token_hash": { + "name": "access_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "refresh_token_hash": { + "name": "refresh_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "last_activity": { + "name": "last_activity", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "sessions_user_id_idx": { + "name": "sessions_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "sessions_expires_at_idx": { + "name": "sessions_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + }, + "sessions_access_token_hash_idx": { + "name": "sessions_access_token_hash_idx", + "columns": [ + "access_token_hash" + ], + "isUnique": false + }, + "sessions_refresh_token_hash_idx": { + "name": "sessions_refresh_token_hash_idx", + "columns": [ + "refresh_token_hash" + ], + "isUnique": false + }, + "sessions_last_activity_idx": { + "name": "sessions_last_activity_idx", + "columns": [ + "last_activity" + ], + "isUnique": false + }, + "sessions_is_revoked_idx": { + "name": "sessions_is_revoked_idx", + "columns": [ + "is_revoked" + ], + "isUnique": false + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "stars": { + "name": "stars", + "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 + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "starred_at": { + "name": "starred_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "stars_user_app_idx": { + "name": "stars_user_app_idx", + "columns": [ + "user_id", + "app_id" + ], + "isUnique": true + }, + "stars_user_idx": { + "name": "stars_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "stars_app_idx": { + "name": "stars_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "stars_user_id_users_id_fk": { + "name": "stars_user_id_users_id_fk", + "tableFrom": "stars", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "stars_app_id_apps_id_fk": { + "name": "stars_app_id_apps_id_fk", + "tableFrom": "stars", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "system_settings": { + "name": "system_settings", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "system_settings_key_unique": { + "name": "system_settings_key_unique", + "columns": [ + "key" + ], + "isUnique": true + }, + "system_settings_key_idx": { + "name": "system_settings_key_idx", + "columns": [ + "key" + ], + "isUnique": true + } + }, + "foreignKeys": { + "system_settings_updated_by_users_id_fk": { + "name": "system_settings_updated_by_users_id_fk", + "tableFrom": "system_settings", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "team_members": { + "name": "team_members", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'member'" + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invited_at": { + "name": "invited_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "joined_at": { + "name": "joined_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "team_members_team_user_idx": { + "name": "team_members_team_user_idx", + "columns": [ + "team_id", + "user_id" + ], + "isUnique": true + }, + "team_members_user_idx": { + "name": "team_members_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "team_members_role_idx": { + "name": "team_members_role_idx", + "columns": [ + "role" + ], + "isUnique": false + }, + "team_members_status_idx": { + "name": "team_members_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "team_members_team_id_teams_id_fk": { + "name": "team_members_team_id_teams_id_fk", + "tableFrom": "team_members", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_members_user_id_users_id_fk": { + "name": "team_members_user_id_users_id_fk", + "tableFrom": "team_members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_members_invited_by_users_id_fk": { + "name": "team_members_invited_by_users_id_fk", + "tableFrom": "team_members", + "tableTo": "users", + "columnsFrom": [ + "invited_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "teams": { + "name": "teams", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'private'" + }, + "allow_member_invites": { + "name": "allow_member_invites", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'free'" + }, + "max_members": { + "name": "max_members", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 5 + }, + "max_apps": { + "name": "max_apps", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 10 + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "teams_slug_unique": { + "name": "teams_slug_unique", + "columns": [ + "slug" + ], + "isUnique": true + }, + "teams_slug_idx": { + "name": "teams_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "teams_owner_idx": { + "name": "teams_owner_idx", + "columns": [ + "owner_id" + ], + "isUnique": false + }, + "teams_visibility_idx": { + "name": "teams_visibility_idx", + "columns": [ + "visibility" + ], + "isUnique": false + } + }, + "foreignKeys": { + "teams_owner_id_users_id_fk": { + "name": "teams_owner_id_users_id_fk", + "tableFrom": "teams", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_model_configs": { + "name": "user_model_configs", + "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 + }, + "agent_action_name": { + "name": "agent_action_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model_name": { + "name": "model_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "max_tokens": { + "name": "max_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "temperature": { + "name": "temperature", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reasoning_effort": { + "name": "reasoning_effort", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_override": { + "name": "provider_override", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "fallback_model": { + "name": "fallback_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_model_configs_user_agent_idx": { + "name": "user_model_configs_user_agent_idx", + "columns": [ + "user_id", + "agent_action_name" + ], + "isUnique": true + }, + "user_model_configs_user_idx": { + "name": "user_model_configs_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_model_configs_is_active_idx": { + "name": "user_model_configs_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_model_configs_user_id_users_id_fk": { + "name": "user_model_configs_user_id_users_id_fk", + "tableFrom": "user_model_configs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_model_providers": { + "name": "user_model_providers", + "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 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secret_id": { + "name": "secret_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_model_providers_user_name_idx": { + "name": "user_model_providers_user_name_idx", + "columns": [ + "user_id", + "name" + ], + "isUnique": true + }, + "user_model_providers_user_idx": { + "name": "user_model_providers_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_model_providers_is_active_idx": { + "name": "user_model_providers_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_model_providers_user_id_users_id_fk": { + "name": "user_model_providers_user_id_users_id_fk", + "tableFrom": "user_model_providers", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_model_providers_secret_id_user_secrets_id_fk": { + "name": "user_model_providers_secret_id_user_secrets_id_fk", + "tableFrom": "user_model_providers", + "tableTo": "user_secrets", + "columnsFrom": [ + "secret_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_provider_keys": { + "name": "user_provider_keys", + "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 + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_tested": { + "name": "last_tested", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "test_status": { + "name": "test_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "test_error": { + "name": "test_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_provider_keys_user_provider_idx": { + "name": "user_provider_keys_user_provider_idx", + "columns": [ + "user_id", + "provider" + ], + "isUnique": true + }, + "user_provider_keys_user_idx": { + "name": "user_provider_keys_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_provider_keys_provider_idx": { + "name": "user_provider_keys_provider_idx", + "columns": [ + "provider" + ], + "isUnique": false + }, + "user_provider_keys_is_active_idx": { + "name": "user_provider_keys_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + }, + "user_provider_keys_test_status_idx": { + "name": "user_provider_keys_test_status_idx", + "columns": [ + "test_status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_provider_keys_user_id_users_id_fk": { + "name": "user_provider_keys_user_id_users_id_fk", + "tableFrom": "user_provider_keys", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_secrets": { + "name": "user_secrets", + "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 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secret_type": { + "name": "secret_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encrypted_value": { + "name": "encrypted_value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "environment": { + "name": "environment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'production'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_used": { + "name": "last_used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "usage_count": { + "name": "usage_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_secrets_user_idx": { + "name": "user_secrets_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_secrets_provider_idx": { + "name": "user_secrets_provider_idx", + "columns": [ + "provider" + ], + "isUnique": false + }, + "user_secrets_user_provider_idx": { + "name": "user_secrets_user_provider_idx", + "columns": [ + "user_id", + "provider", + "secret_type" + ], + "isUnique": false + }, + "user_secrets_active_idx": { + "name": "user_secrets_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_secrets_user_id_users_id_fk": { + "name": "user_secrets_user_id_users_id_fk", + "tableFrom": "user_secrets", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "bio": { + "name": "bio", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email_verified": { + "name": "email_verified", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "failed_login_attempts": { + "name": "failed_login_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "locked_until": { + "name": "locked_until", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "password_changed_at": { + "name": "password_changed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "preferences": { + "name": "preferences", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'{}'" + }, + "theme": { + "name": "theme", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'system'" + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'UTC'" + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "is_suspended": { + "name": "is_suspended", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "last_active_at": { + "name": "last_active_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "users_email_unique": { + "name": "users_email_unique", + "columns": [ + "email" + ], + "isUnique": true + }, + "users_username_unique": { + "name": "users_username_unique", + "columns": [ + "username" + ], + "isUnique": true + }, + "users_email_idx": { + "name": "users_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "users_provider_unique_idx": { + "name": "users_provider_unique_idx", + "columns": [ + "provider", + "provider_id" + ], + "isUnique": true + }, + "users_username_idx": { + "name": "users_username_idx", + "columns": [ + "username" + ], + "isUnique": false + }, + "users_failed_login_attempts_idx": { + "name": "users_failed_login_attempts_idx", + "columns": [ + "failed_login_attempts" + ], + "isUnique": false + }, + "users_locked_until_idx": { + "name": "users_locked_until_idx", + "columns": [ + "locked_until" + ], + "isUnique": false + }, + "users_is_active_idx": { + "name": "users_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + }, + "users_last_active_at_idx": { + "name": "users_last_active_at_idx", + "columns": [ + "last_active_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "verification_otps": { + "name": "verification_otps", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "otp": { + "name": "otp", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "used": { + "name": "used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "used_at": { + "name": "used_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "verification_otps_email_idx": { + "name": "verification_otps_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "verification_otps_expires_at_idx": { + "name": "verification_otps_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + }, + "verification_otps_used_idx": { + "name": "verification_otps_used_idx", + "columns": [ + "used" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/migrations/meta/0011_snapshot.json b/migrations/meta/0011_snapshot.json new file mode 100644 index 00000000..15014459 --- /dev/null +++ b/migrations/meta/0011_snapshot.json @@ -0,0 +1,3714 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "705bc180-fd81-4820-beb2-4051e871f783", + "prevId": "7d8f06c8-fede-4b2e-a217-bd9ff5913b28", + "tables": { + "api_keys": { + "name": "api_keys", + "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 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "last_used": { + "name": "last_used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "request_count": { + "name": "request_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "api_keys_key_hash_unique": { + "name": "api_keys_key_hash_unique", + "columns": [ + "key_hash" + ], + "isUnique": true + }, + "api_keys_user_id_idx": { + "name": "api_keys_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "api_keys_key_hash_idx": { + "name": "api_keys_key_hash_idx", + "columns": [ + "key_hash" + ], + "isUnique": false + }, + "api_keys_is_active_idx": { + "name": "api_keys_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + }, + "api_keys_expires_at_idx": { + "name": "api_keys_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "api_keys_user_id_users_id_fk": { + "name": "api_keys_user_id_users_id_fk", + "tableFrom": "api_keys", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_categories": { + "name": "app_categories", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "category_name": { + "name": "category_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_categories_app_category_idx": { + "name": "app_categories_app_category_idx", + "columns": [ + "app_id", + "category_name" + ], + "isUnique": true + }, + "app_categories_category_name_idx": { + "name": "app_categories_category_name_idx", + "columns": [ + "category_name" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_categories_app_id_apps_id_fk": { + "name": "app_categories_app_id_apps_id_fk", + "tableFrom": "app_categories", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_comments": { + "name": "app_comments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_edited": { + "name": "is_edited", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_deleted": { + "name": "is_deleted", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_comments_app_idx": { + "name": "app_comments_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + }, + "app_comments_user_idx": { + "name": "app_comments_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "app_comments_parent_idx": { + "name": "app_comments_parent_idx", + "columns": [ + "parent_comment_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_comments_app_id_apps_id_fk": { + "name": "app_comments_app_id_apps_id_fk", + "tableFrom": "app_comments", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "app_comments_user_id_users_id_fk": { + "name": "app_comments_user_id_users_id_fk", + "tableFrom": "app_comments", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_likes": { + "name": "app_likes", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reaction_type": { + "name": "reaction_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'like'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_likes_app_user_idx": { + "name": "app_likes_app_user_idx", + "columns": [ + "app_id", + "user_id" + ], + "isUnique": true + }, + "app_likes_user_idx": { + "name": "app_likes_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_likes_app_id_apps_id_fk": { + "name": "app_likes_app_id_apps_id_fk", + "tableFrom": "app_likes", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "app_likes_user_id_users_id_fk": { + "name": "app_likes_user_id_users_id_fk", + "tableFrom": "app_likes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_tags": { + "name": "app_tags", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tag_name": { + "name": "tag_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "app_tags_app_tag_idx": { + "name": "app_tags_app_tag_idx", + "columns": [ + "app_id", + "tag_name" + ], + "isUnique": true + }, + "app_tags_tag_name_idx": { + "name": "app_tags_tag_name_idx", + "columns": [ + "tag_name" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_tags_app_id_apps_id_fk": { + "name": "app_tags_app_id_apps_id_fk", + "tableFrom": "app_tags", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "app_views": { + "name": "app_views", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_address_hash": { + "name": "ip_address_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "referrer": { + "name": "referrer", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "device_type": { + "name": "device_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "viewed_at": { + "name": "viewed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "duration_seconds": { + "name": "duration_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "app_views_app_idx": { + "name": "app_views_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + }, + "app_views_user_idx": { + "name": "app_views_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "app_views_viewed_at_idx": { + "name": "app_views_viewed_at_idx", + "columns": [ + "viewed_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "app_views_app_id_apps_id_fk": { + "name": "app_views_app_id_apps_id_fk", + "tableFrom": "app_views", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "app_views_user_id_users_id_fk": { + "name": "app_views_user_id_users_id_fk", + "tableFrom": "app_views", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "apps": { + "name": "apps", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "icon_url": { + "name": "icon_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "original_prompt": { + "name": "original_prompt", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "final_prompt": { + "name": "final_prompt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "blueprint": { + "name": "blueprint", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "framework": { + "name": "framework", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "session_token": { + "name": "session_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'private'" + }, + "board_id": { + "name": "board_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'generating'" + }, + "deployment_url": { + "name": "deployment_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cloudflare_account_id": { + "name": "cloudflare_account_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deployment_status": { + "name": "deployment_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'none'" + }, + "deployment_metadata": { + "name": "deployment_metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'{}'" + }, + "github_repository_url": { + "name": "github_repository_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "github_repository_visibility": { + "name": "github_repository_visibility", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_archived": { + "name": "is_archived", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_featured": { + "name": "is_featured", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 1 + }, + "parent_app_id": { + "name": "parent_app_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "screenshot_url": { + "name": "screenshot_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "screenshot_captured_at": { + "name": "screenshot_captured_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "last_deployed_at": { + "name": "last_deployed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "apps_user_idx": { + "name": "apps_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "apps_team_idx": { + "name": "apps_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "apps_board_idx": { + "name": "apps_board_idx", + "columns": [ + "board_id" + ], + "isUnique": false + }, + "apps_status_idx": { + "name": "apps_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "apps_visibility_idx": { + "name": "apps_visibility_idx", + "columns": [ + "visibility" + ], + "isUnique": false + }, + "apps_slug_idx": { + "name": "apps_slug_idx", + "columns": [ + "slug" + ], + "isUnique": false + }, + "apps_session_token_idx": { + "name": "apps_session_token_idx", + "columns": [ + "session_token" + ], + "isUnique": false + }, + "apps_parent_app_idx": { + "name": "apps_parent_app_idx", + "columns": [ + "parent_app_id" + ], + "isUnique": false + }, + "apps_search_idx": { + "name": "apps_search_idx", + "columns": [ + "title", + "description" + ], + "isUnique": false + }, + "apps_framework_status_idx": { + "name": "apps_framework_status_idx", + "columns": [ + "framework", + "status" + ], + "isUnique": false + }, + "apps_visibility_status_idx": { + "name": "apps_visibility_status_idx", + "columns": [ + "visibility", + "status" + ], + "isUnique": false + }, + "apps_created_at_idx": { + "name": "apps_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + }, + "apps_updated_at_idx": { + "name": "apps_updated_at_idx", + "columns": [ + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "apps_user_id_users_id_fk": { + "name": "apps_user_id_users_id_fk", + "tableFrom": "apps", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "apps_team_id_teams_id_fk": { + "name": "apps_team_id_teams_id_fk", + "tableFrom": "apps", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "apps_board_id_boards_id_fk": { + "name": "apps_board_id_boards_id_fk", + "tableFrom": "apps", + "tableTo": "boards", + "columnsFrom": [ + "board_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "audit_logs": { + "name": "audit_logs", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "old_values": { + "name": "old_values", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "new_values": { + "name": "new_values", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "audit_logs_user_idx": { + "name": "audit_logs_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "audit_logs_entity_idx": { + "name": "audit_logs_entity_idx", + "columns": [ + "entity_type", + "entity_id" + ], + "isUnique": false + }, + "audit_logs_created_at_idx": { + "name": "audit_logs_created_at_idx", + "columns": [ + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "audit_logs_user_id_users_id_fk": { + "name": "audit_logs_user_id_users_id_fk", + "tableFrom": "audit_logs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "auth_attempts": { + "name": "auth_attempts", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "attempt_type": { + "name": "attempt_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "success": { + "name": "success", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attempted_at": { + "name": "attempted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "auth_attempts_lookup_idx": { + "name": "auth_attempts_lookup_idx", + "columns": [ + "identifier", + "attempted_at" + ], + "isUnique": false + }, + "auth_attempts_ip_idx": { + "name": "auth_attempts_ip_idx", + "columns": [ + "ip_address", + "attempted_at" + ], + "isUnique": false + }, + "auth_attempts_success_idx": { + "name": "auth_attempts_success_idx", + "columns": [ + "success", + "attempted_at" + ], + "isUnique": false + }, + "auth_attempts_type_idx": { + "name": "auth_attempts_type_idx", + "columns": [ + "attempt_type", + "attempted_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "board_members": { + "name": "board_members", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "board_id": { + "name": "board_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'member'" + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "is_banned": { + "name": "is_banned", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "banned_at": { + "name": "banned_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned_reason": { + "name": "banned_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "joined_at": { + "name": "joined_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "board_members_board_user_idx": { + "name": "board_members_board_user_idx", + "columns": [ + "board_id", + "user_id" + ], + "isUnique": true + }, + "board_members_user_idx": { + "name": "board_members_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "board_members_board_id_boards_id_fk": { + "name": "board_members_board_id_boards_id_fk", + "tableFrom": "board_members", + "tableTo": "boards", + "columnsFrom": [ + "board_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "board_members_user_id_users_id_fk": { + "name": "board_members_user_id_users_id_fk", + "tableFrom": "board_members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "boards": { + "name": "boards", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "icon_url": { + "name": "icon_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banner_url": { + "name": "banner_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'public'" + }, + "allow_submissions": { + "name": "allow_submissions", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "require_approval": { + "name": "require_approval", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "rules": { + "name": "rules", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "guidelines": { + "name": "guidelines", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "boards_slug_unique": { + "name": "boards_slug_unique", + "columns": [ + "slug" + ], + "isUnique": true + }, + "boards_slug_idx": { + "name": "boards_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "boards_owner_idx": { + "name": "boards_owner_idx", + "columns": [ + "owner_id" + ], + "isUnique": false + }, + "boards_team_idx": { + "name": "boards_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "boards_visibility_idx": { + "name": "boards_visibility_idx", + "columns": [ + "visibility" + ], + "isUnique": false + } + }, + "foreignKeys": { + "boards_owner_id_users_id_fk": { + "name": "boards_owner_id_users_id_fk", + "tableFrom": "boards", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "boards_team_id_teams_id_fk": { + "name": "boards_team_id_teams_id_fk", + "tableFrom": "boards", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "cloudflare_accounts": { + "name": "cloudflare_accounts", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "api_token_hash": { + "name": "api_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_default": { + "name": "is_default", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "capabilities": { + "name": "capabilities", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "last_validated": { + "name": "last_validated", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "validation_status": { + "name": "validation_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "cf_accounts_user_idx": { + "name": "cf_accounts_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "cf_accounts_team_idx": { + "name": "cf_accounts_team_idx", + "columns": [ + "team_id" + ], + "isUnique": false + }, + "cf_accounts_account_id_idx": { + "name": "cf_accounts_account_id_idx", + "columns": [ + "account_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "cloudflare_accounts_user_id_users_id_fk": { + "name": "cloudflare_accounts_user_id_users_id_fk", + "tableFrom": "cloudflare_accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "cloudflare_accounts_team_id_teams_id_fk": { + "name": "cloudflare_accounts_team_id_teams_id_fk", + "tableFrom": "cloudflare_accounts", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "comment_likes": { + "name": "comment_likes", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "comment_id": { + "name": "comment_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reaction_type": { + "name": "reaction_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'like'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "comment_likes_comment_user_idx": { + "name": "comment_likes_comment_user_idx", + "columns": [ + "comment_id", + "user_id" + ], + "isUnique": true + }, + "comment_likes_user_idx": { + "name": "comment_likes_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "comment_likes_comment_idx": { + "name": "comment_likes_comment_idx", + "columns": [ + "comment_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "comment_likes_comment_id_app_comments_id_fk": { + "name": "comment_likes_comment_id_app_comments_id_fk", + "tableFrom": "comment_likes", + "tableTo": "app_comments", + "columnsFrom": [ + "comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "comment_likes_user_id_users_id_fk": { + "name": "comment_likes_user_id_users_id_fk", + "tableFrom": "comment_likes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "email_verification_tokens": { + "name": "email_verification_tokens", + "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 + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "used": { + "name": "used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "email_verification_tokens_token_hash_unique": { + "name": "email_verification_tokens_token_hash_unique", + "columns": [ + "token_hash" + ], + "isUnique": true + }, + "email_verification_tokens_lookup_idx": { + "name": "email_verification_tokens_lookup_idx", + "columns": [ + "token_hash" + ], + "isUnique": false + }, + "email_verification_tokens_expiry_idx": { + "name": "email_verification_tokens_expiry_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "email_verification_tokens_user_id_users_id_fk": { + "name": "email_verification_tokens_user_id_users_id_fk", + "tableFrom": "email_verification_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "favorites": { + "name": "favorites", + "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 + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "favorites_user_app_idx": { + "name": "favorites_user_app_idx", + "columns": [ + "user_id", + "app_id" + ], + "isUnique": true + }, + "favorites_user_idx": { + "name": "favorites_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "favorites_app_idx": { + "name": "favorites_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "favorites_user_id_users_id_fk": { + "name": "favorites_user_id_users_id_fk", + "tableFrom": "favorites", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "favorites_app_id_apps_id_fk": { + "name": "favorites_app_id_apps_id_fk", + "tableFrom": "favorites", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "oauth_states": { + "name": "oauth_states", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "redirect_uri": { + "name": "redirect_uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "code_verifier": { + "name": "code_verifier", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "nonce": { + "name": "nonce", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_used": { + "name": "is_used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + } + }, + "indexes": { + "oauth_states_state_unique": { + "name": "oauth_states_state_unique", + "columns": [ + "state" + ], + "isUnique": true + }, + "oauth_states_state_idx": { + "name": "oauth_states_state_idx", + "columns": [ + "state" + ], + "isUnique": true + }, + "oauth_states_expires_at_idx": { + "name": "oauth_states_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "oauth_states_user_id_users_id_fk": { + "name": "oauth_states_user_id_users_id_fk", + "tableFrom": "oauth_states", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "password_reset_tokens": { + "name": "password_reset_tokens", + "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 + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "used": { + "name": "used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "password_reset_tokens_token_hash_unique": { + "name": "password_reset_tokens_token_hash_unique", + "columns": [ + "token_hash" + ], + "isUnique": true + }, + "password_reset_tokens_lookup_idx": { + "name": "password_reset_tokens_lookup_idx", + "columns": [ + "token_hash" + ], + "isUnique": false + }, + "password_reset_tokens_expiry_idx": { + "name": "password_reset_tokens_expiry_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "password_reset_tokens_user_id_users_id_fk": { + "name": "password_reset_tokens_user_id_users_id_fk", + "tableFrom": "password_reset_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "sessions": { + "name": "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 + }, + "device_info": { + "name": "device_info", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_revoked": { + "name": "is_revoked", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "revoked_reason": { + "name": "revoked_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "access_token_hash": { + "name": "access_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "refresh_token_hash": { + "name": "refresh_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "last_activity": { + "name": "last_activity", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "sessions_user_id_idx": { + "name": "sessions_user_id_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "sessions_expires_at_idx": { + "name": "sessions_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + }, + "sessions_access_token_hash_idx": { + "name": "sessions_access_token_hash_idx", + "columns": [ + "access_token_hash" + ], + "isUnique": false + }, + "sessions_refresh_token_hash_idx": { + "name": "sessions_refresh_token_hash_idx", + "columns": [ + "refresh_token_hash" + ], + "isUnique": false + }, + "sessions_last_activity_idx": { + "name": "sessions_last_activity_idx", + "columns": [ + "last_activity" + ], + "isUnique": false + }, + "sessions_is_revoked_idx": { + "name": "sessions_is_revoked_idx", + "columns": [ + "is_revoked" + ], + "isUnique": false + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "stars": { + "name": "stars", + "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 + }, + "app_id": { + "name": "app_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "starred_at": { + "name": "starred_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "stars_user_app_idx": { + "name": "stars_user_app_idx", + "columns": [ + "user_id", + "app_id" + ], + "isUnique": true + }, + "stars_user_idx": { + "name": "stars_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "stars_app_idx": { + "name": "stars_app_idx", + "columns": [ + "app_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "stars_user_id_users_id_fk": { + "name": "stars_user_id_users_id_fk", + "tableFrom": "stars", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "stars_app_id_apps_id_fk": { + "name": "stars_app_id_apps_id_fk", + "tableFrom": "stars", + "tableTo": "apps", + "columnsFrom": [ + "app_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "system_settings": { + "name": "system_settings", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "system_settings_key_unique": { + "name": "system_settings_key_unique", + "columns": [ + "key" + ], + "isUnique": true + }, + "system_settings_key_idx": { + "name": "system_settings_key_idx", + "columns": [ + "key" + ], + "isUnique": true + } + }, + "foreignKeys": { + "system_settings_updated_by_users_id_fk": { + "name": "system_settings_updated_by_users_id_fk", + "tableFrom": "system_settings", + "tableTo": "users", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "team_members": { + "name": "team_members", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "team_id": { + "name": "team_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'member'" + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'[]'" + }, + "invited_by": { + "name": "invited_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invited_at": { + "name": "invited_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "joined_at": { + "name": "joined_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "team_members_team_user_idx": { + "name": "team_members_team_user_idx", + "columns": [ + "team_id", + "user_id" + ], + "isUnique": true + }, + "team_members_user_idx": { + "name": "team_members_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "team_members_role_idx": { + "name": "team_members_role_idx", + "columns": [ + "role" + ], + "isUnique": false + }, + "team_members_status_idx": { + "name": "team_members_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "team_members_team_id_teams_id_fk": { + "name": "team_members_team_id_teams_id_fk", + "tableFrom": "team_members", + "tableTo": "teams", + "columnsFrom": [ + "team_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_members_user_id_users_id_fk": { + "name": "team_members_user_id_users_id_fk", + "tableFrom": "team_members", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "team_members_invited_by_users_id_fk": { + "name": "team_members_invited_by_users_id_fk", + "tableFrom": "team_members", + "tableTo": "users", + "columnsFrom": [ + "invited_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "teams": { + "name": "teams", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'private'" + }, + "allow_member_invites": { + "name": "allow_member_invites", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "plan": { + "name": "plan", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'free'" + }, + "max_members": { + "name": "max_members", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 5 + }, + "max_apps": { + "name": "max_apps", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 10 + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "teams_slug_unique": { + "name": "teams_slug_unique", + "columns": [ + "slug" + ], + "isUnique": true + }, + "teams_slug_idx": { + "name": "teams_slug_idx", + "columns": [ + "slug" + ], + "isUnique": true + }, + "teams_owner_idx": { + "name": "teams_owner_idx", + "columns": [ + "owner_id" + ], + "isUnique": false + }, + "teams_visibility_idx": { + "name": "teams_visibility_idx", + "columns": [ + "visibility" + ], + "isUnique": false + } + }, + "foreignKeys": { + "teams_owner_id_users_id_fk": { + "name": "teams_owner_id_users_id_fk", + "tableFrom": "teams", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_model_configs": { + "name": "user_model_configs", + "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 + }, + "agent_action_name": { + "name": "agent_action_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model_name": { + "name": "model_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "max_tokens": { + "name": "max_tokens", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "temperature": { + "name": "temperature", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reasoning_effort": { + "name": "reasoning_effort", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider_override": { + "name": "provider_override", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "fallback_model": { + "name": "fallback_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_model_configs_user_agent_idx": { + "name": "user_model_configs_user_agent_idx", + "columns": [ + "user_id", + "agent_action_name" + ], + "isUnique": true + }, + "user_model_configs_user_idx": { + "name": "user_model_configs_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_model_configs_is_active_idx": { + "name": "user_model_configs_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_model_configs_user_id_users_id_fk": { + "name": "user_model_configs_user_id_users_id_fk", + "tableFrom": "user_model_configs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_model_providers": { + "name": "user_model_providers", + "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 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secret_id": { + "name": "secret_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_model_providers_user_name_idx": { + "name": "user_model_providers_user_name_idx", + "columns": [ + "user_id", + "name" + ], + "isUnique": true + }, + "user_model_providers_user_idx": { + "name": "user_model_providers_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_model_providers_is_active_idx": { + "name": "user_model_providers_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_model_providers_user_id_users_id_fk": { + "name": "user_model_providers_user_id_users_id_fk", + "tableFrom": "user_model_providers", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_model_providers_secret_id_user_secrets_id_fk": { + "name": "user_model_providers_secret_id_user_secrets_id_fk", + "tableFrom": "user_model_providers", + "tableTo": "user_secrets", + "columnsFrom": [ + "secret_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_provider_keys": { + "name": "user_provider_keys", + "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 + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encrypted_api_key": { + "name": "encrypted_api_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_tested": { + "name": "last_tested", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "test_status": { + "name": "test_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "test_error": { + "name": "test_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_provider_keys_user_provider_idx": { + "name": "user_provider_keys_user_provider_idx", + "columns": [ + "user_id", + "provider" + ], + "isUnique": true + }, + "user_provider_keys_user_idx": { + "name": "user_provider_keys_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_provider_keys_provider_idx": { + "name": "user_provider_keys_provider_idx", + "columns": [ + "provider" + ], + "isUnique": false + }, + "user_provider_keys_is_active_idx": { + "name": "user_provider_keys_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + }, + "user_provider_keys_test_status_idx": { + "name": "user_provider_keys_test_status_idx", + "columns": [ + "test_status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_provider_keys_user_id_users_id_fk": { + "name": "user_provider_keys_user_id_users_id_fk", + "tableFrom": "user_provider_keys", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user_secrets": { + "name": "user_secrets", + "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 + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secret_type": { + "name": "secret_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encrypted_value": { + "name": "encrypted_value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_preview": { + "name": "key_preview", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "environment": { + "name": "environment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'production'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_used": { + "name": "last_used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "usage_count": { + "name": "usage_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "user_secrets_user_idx": { + "name": "user_secrets_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "user_secrets_provider_idx": { + "name": "user_secrets_provider_idx", + "columns": [ + "provider" + ], + "isUnique": false + }, + "user_secrets_user_provider_idx": { + "name": "user_secrets_user_provider_idx", + "columns": [ + "user_id", + "provider", + "secret_type" + ], + "isUnique": false + }, + "user_secrets_active_idx": { + "name": "user_secrets_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + } + }, + "foreignKeys": { + "user_secrets_user_id_users_id_fk": { + "name": "user_secrets_user_id_users_id_fk", + "tableFrom": "user_secrets", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "avatar_url": { + "name": "avatar_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "bio": { + "name": "bio", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email_verified": { + "name": "email_verified", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "password_hash": { + "name": "password_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "failed_login_attempts": { + "name": "failed_login_attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": 0 + }, + "locked_until": { + "name": "locked_until", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "password_changed_at": { + "name": "password_changed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "preferences": { + "name": "preferences", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'{}'" + }, + "theme": { + "name": "theme", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'system'" + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "'UTC'" + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": true + }, + "is_suspended": { + "name": "is_suspended", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + }, + "last_active_at": { + "name": "last_active_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "deleted_at": { + "name": "deleted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "users_email_unique": { + "name": "users_email_unique", + "columns": [ + "email" + ], + "isUnique": true + }, + "users_username_unique": { + "name": "users_username_unique", + "columns": [ + "username" + ], + "isUnique": true + }, + "users_email_idx": { + "name": "users_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "users_provider_unique_idx": { + "name": "users_provider_unique_idx", + "columns": [ + "provider", + "provider_id" + ], + "isUnique": true + }, + "users_username_idx": { + "name": "users_username_idx", + "columns": [ + "username" + ], + "isUnique": false + }, + "users_failed_login_attempts_idx": { + "name": "users_failed_login_attempts_idx", + "columns": [ + "failed_login_attempts" + ], + "isUnique": false + }, + "users_locked_until_idx": { + "name": "users_locked_until_idx", + "columns": [ + "locked_until" + ], + "isUnique": false + }, + "users_is_active_idx": { + "name": "users_is_active_idx", + "columns": [ + "is_active" + ], + "isUnique": false + }, + "users_last_active_at_idx": { + "name": "users_last_active_at_idx", + "columns": [ + "last_active_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "verification_otps": { + "name": "verification_otps", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "otp": { + "name": "otp", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "used": { + "name": "used", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "used_at": { + "name": "used_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP" + } + }, + "indexes": { + "verification_otps_email_idx": { + "name": "verification_otps_email_idx", + "columns": [ + "email" + ], + "isUnique": false + }, + "verification_otps_expires_at_idx": { + "name": "verification_otps_expires_at_idx", + "columns": [ + "expires_at" + ], + "isUnique": false + }, + "verification_otps_used_idx": { + "name": "verification_otps_used_idx", + "columns": [ + "used" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index f2b2b52f..14963e93 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -71,6 +71,20 @@ "when": 1756429831357, "tag": "0009_next_apocalypse", "breakpoints": true + }, + { + "idx": 10, + "version": "6", + "when": 1756453884503, + "tag": "0010_neat_firedrake", + "breakpoints": true + }, + { + "idx": 11, + "version": "6", + "when": 1756458362008, + "tag": "0011_even_drax", + "breakpoints": true } ] } \ No newline at end of file diff --git a/package.json b/package.json index 9964768e..1152da97 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,6 @@ "devDependencies": { "@cloudflare/vite-plugin": "^1.11.4", "@cloudflare/vitest-pool-workers": "^0.8.55", - "@cloudflare/workers-types": "^4.20250810.0", "@eslint/js": "^9.25.1", "@tailwindcss/typography": "^0.5.16", "@tailwindcss/vite": "^4.1.11", diff --git a/tsconfig.worker.json b/tsconfig.worker.json index 88364c7b..244e8a65 100644 --- a/tsconfig.worker.json +++ b/tsconfig.worker.json @@ -3,7 +3,9 @@ "compilerOptions": { "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo", "types": ["./worker-configuration.d.ts", "vite/client", "jest"], - "lib": ["ES2023", "WebWorker", "ESNext.Intl"] + "lib": ["ES2023", "WebWorker", "ESNext.Intl"], + // "experimentalDecorators": true, + // "emitDecoratorMetadata": true }, "include": ["worker"] } diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 033440f5..b673234d 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -1,12 +1,12 @@ /* eslint-disable */ -// Generated by Wrangler by running `wrangler types` (hash: 9c73f940d5e22d8ff51e7518b55f37b0) +// Generated by Wrangler by running `wrangler types` (hash: 55c5d55aea8f58e4250cba937090a82a) // Runtime types generated with workerd@1.20250816.0 2025-08-10 nodejs_compat declare namespace Cloudflare { interface Env { INSTANCE_REGISTRY: KVNamespace; TEMPLATES_REPOSITORY: "https://github.com/cloudflare/vibesdk-templates"; - CLOUDFLARE_AI_GATEWAY: "orange-build-gateway"; ALLOWED_EMAIL: "your-email@example.com"; + CLOUDFLARE_AI_GATEWAY: "orange-build-gateway"; ANTHROPIC_API_KEY: string; OPENAI_API_KEY: string; GOOGLE_AI_STUDIO_API_KEY: string; @@ -56,7 +56,7 @@ type StringifyValues> = { [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string; }; declare namespace NodeJS { - interface ProcessEnv extends StringifyValues> {} + interface ProcessEnv extends StringifyValues> {} } // Begin runtime types diff --git a/worker/api/controllers/appView/controller.ts b/worker/api/controllers/appView/controller.ts index b1f327e2..89638be3 100644 --- a/worker/api/controllers/appView/controller.ts +++ b/worker/api/controllers/appView/controller.ts @@ -1,7 +1,7 @@ import { BaseController } from '../BaseController'; import { ApiResponse, ControllerResponse } from '../BaseController.types'; -import { RouteContext } from '../../types/route-context'; +import type { RouteContext } from '../../types/route-context'; import { cloneAgent, getAgentStub } from '../../../agents'; import { AppService } from '../../../database/services/AppService'; import { @@ -10,6 +10,7 @@ import { ForkAppData, } from './types'; import { AgentSummary } from '../../../agents/core/types'; +import { withCache } from '../../../services/cache/wrapper'; export class AppViewController extends BaseController { constructor() { @@ -17,7 +18,8 @@ export class AppViewController extends BaseController { } // Get single app details (public endpoint, auth optional for ownership check) - async getAppDetails(request: Request, env: Env, _ctx: ExecutionContext, context: RouteContext): Promise>> { + getAppDetails = withCache( + async function(this: AppViewController, request: Request, env: Env, _ctx: ExecutionContext, context: RouteContext): Promise>> { try { const appId = context.pathParams.id; if (!appId) { @@ -84,7 +86,9 @@ export class AppViewController extends BaseController { this.logger.error('Error fetching app details:', error); return this.createErrorResponse('Internal server error', 500); } - } + }, + { ttlSeconds: 3 * 60 * 60, tags: ['app-details'] } + ); // Star/unstar an app async toggleAppStar(_request: Request, env: Env, _ctx: ExecutionContext, context: RouteContext): Promise>> { diff --git a/worker/api/controllers/apps/controller.ts b/worker/api/controllers/apps/controller.ts index 12294482..29e9daff 100644 --- a/worker/api/controllers/apps/controller.ts +++ b/worker/api/controllers/apps/controller.ts @@ -4,7 +4,7 @@ import type { BatchAppStats, AppSortOption, SortOrder, TimePeriod } from '../../ import { formatRelativeTime } from '../../../utils/timeFormatter'; import { BaseController } from '../BaseController'; import { ApiResponse, ControllerResponse } from '../BaseController.types'; -import { RouteContext } from '../../types/route-context'; +import type { RouteContext } from '../../types/route-context'; import { AppsListData, PublicAppsData, @@ -13,6 +13,7 @@ import { UpdateAppVisibilityData, AppDeleteData } from './types'; +import { withCache } from '../../../services/cache/wrapper'; export class AppController extends BaseController { constructor() { @@ -20,7 +21,8 @@ export class AppController extends BaseController { } // Get all apps for the current user - async getUserApps(_request: Request, env: Env, _ctx: ExecutionContext, context: RouteContext): Promise>> { + getUserApps = withCache( + async function(this: AppController, _request: Request, env: Env, _ctx: ExecutionContext, context: RouteContext): Promise>> { try { const user = this.extractAuthUser(context); if (!user) { @@ -42,7 +44,9 @@ export class AppController extends BaseController { this.logger.error('Error fetching user apps:', error); return this.createErrorResponse('Failed to fetch apps', 500); } - } + }, + { ttlSeconds: 12 * 60, tags: ['user-apps'] } + ); // Get recent apps (last 10) async getRecentApps(_request: Request, env: Env, _ctx: ExecutionContext, context: RouteContext): Promise>> { @@ -130,7 +134,8 @@ export class AppController extends BaseController { } // Get public apps feed (like a global board) - async getPublicApps(request: Request, env: Env, _ctx: ExecutionContext, _context: RouteContext): Promise>> { + getPublicApps = withCache( + async function(this: AppController, request: Request, env: Env, _ctx: ExecutionContext, _context: RouteContext): Promise>> { try { const dbService = this.createDbService(env); const url = new URL(request.url); @@ -254,7 +259,9 @@ export class AppController extends BaseController { this.logger.error('Error fetching public apps:', error); return this.createErrorResponse('Failed to fetch public apps', 500); } - } + }, + { ttlSeconds: 45 * 60, tags: ['public-apps'] } + ); // Get single app async getApp(_request: Request, env: Env, _ctx: ExecutionContext, context: RouteContext): Promise>> { diff --git a/worker/database/services/AppService.ts b/worker/database/services/AppService.ts index d84dd9de..9ed9df34 100644 --- a/worker/database/services/AppService.ts +++ b/worker/database/services/AppService.ts @@ -1037,21 +1037,47 @@ export class AppService extends BaseService { const total = totalQuery[0]?.count || 0; - // Convert to EnhancedAppData format - const enhancedApps: EnhancedAppData[] = await Promise.all( - basicApps.map(async (app: any) => { - const enhancedApp: EnhancedAppData = { - ...app, - starCount: app.starCount || 0, - userStarred: userId ? await this.isAppStarredByUser(app.id, userId) : false, - userFavorited: userId ? await this.isAppFavoritedByUser(app.id, userId) : false, - viewCount: app.viewCount || 0, - forkCount: app.forkCount || 0, - likeCount: 0 - }; - return enhancedApp; - }) - ); + // Batch fetch user interactions to avoid N+1 queries + let userStarredSet = new Set(); + let userFavoritedSet = new Set(); + + if (userId && basicApps.length > 0) { + const appIds = basicApps.map(app => app.id); + + const [userStars, userFavorites] = await Promise.all([ + // Batch query for user stars + this.database + .select({ appId: schema.stars.appId }) + .from(schema.stars) + .where(and( + eq(schema.stars.userId, userId), + inArray(schema.stars.appId, appIds) + )), + + // Batch query for user favorites + this.database + .select({ appId: schema.favorites.appId }) + .from(schema.favorites) + .where(and( + eq(schema.favorites.userId, userId), + inArray(schema.favorites.appId, appIds) + )) + ]); + + userStarredSet = new Set(userStars.map(s => s.appId)); + userFavoritedSet = new Set(userFavorites.map(f => f.appId)); + } + + // Convert to EnhancedAppData format with O(1) lookups + const enhancedApps: EnhancedAppData[] = basicApps.map((app: any) => ({ + ...app, + starCount: app.starCount || 0, + userStarred: userStarredSet.has(app.id), + userFavorited: userFavoritedSet.has(app.id), + viewCount: app.viewCount || 0, + forkCount: app.forkCount || 0, + likeCount: app.likeCount || 0 + })); return { data: enhancedApps, @@ -1163,29 +1189,6 @@ export class AppService extends BaseService { return enhancedApps; } - /** - * Check if app is starred by user (for enhanced app data) - */ - private async isAppStarredByUser(appId: string, userId: string): Promise { - const result = await this.database - .select({ count: sql`COUNT(*)` }) - .from(schema.stars) - .where(and(eq(schema.stars.appId, appId), eq(schema.stars.userId, userId))); - - return (result[0]?.count || 0) > 0; - } - - /** - * Check if app is favorited by user (for enhanced app data) - */ - private async isAppFavoritedByUser(appId: string, userId: string): Promise { - const result = await this.database - .select({ count: sql`COUNT(*)` }) - .from(schema.favorites) - .where(and(eq(schema.favorites.appId, appId), eq(schema.favorites.userId, userId))); - - return (result[0]?.count || 0) > 0; - } // ======================================== // INDUSTRY-STANDARD RANKING ALGORITHMS diff --git a/worker/services/auth/authService.ts b/worker/services/auth/authService.ts index 415cb7fa..87f72fee 100644 --- a/worker/services/auth/authService.ts +++ b/worker/services/auth/authService.ts @@ -599,8 +599,6 @@ export class AuthService { return null; } - // Return the validated URL - logger.info('OAuth redirect URL validated', { redirectUrl }); return redirectUrl; } catch (error) { logger.warn('Invalid OAuth redirect URL format', { redirectUrl, error }); @@ -626,9 +624,6 @@ export class AuthService { // TODO: Send email with OTP (integrate with email service) logger.info('Verification OTP generated', { email, otp: otp.slice(0, 2) + '****' }); - - // For development, log the OTP (remove in production) - console.log(`[DEV] Verification OTP for ${email}: ${otp}`); } /** diff --git a/worker/services/cache/CacheService.ts b/worker/services/cache/CacheService.ts new file mode 100644 index 00000000..bac7bfab --- /dev/null +++ b/worker/services/cache/CacheService.ts @@ -0,0 +1,83 @@ +/** + * Simple Cache Service using Cloudflare Cache API + */ + +export interface CacheOptions { + ttlSeconds: number; + tags?: string[]; +} + +export class CacheService { + /** + * Get cached response + */ + async get(keyOrRequest: string | Request): Promise { + // Use caches.default for Cloudflare Workers + const cache = (caches as any).default; + return await cache.match(keyOrRequest); + } + + /** + * Store response in cache + */ + async put( + keyOrRequest: string | Request, + response: Response, + options: CacheOptions, + ): Promise { + + // Convert Headers to a plain object + const headersObj: Record = {}; + response.headers.forEach((value, key) => { + headersObj[key] = value; + }); + + const responseToCache = new Response(response.body, { + status: response.status, + statusText: response.statusText, + headers: { + ...headersObj, + 'Cache-Control': `public, max-age=${options.ttlSeconds}`, + ...(options.tags + ? { 'Cache-Tag': options.tags.join(',') } + : {}), + }, + }); + + // Use caches.default for Cloudflare Workers + const cache = (caches as any).default; + await cache.put(keyOrRequest, responseToCache); + } + + /** + * Generate cache key from request + */ + generateKey(request: Request, userId?: string): string { + const url = new URL(request.url); + const baseKey = `${url.pathname}${url.search}`; + return userId ? `${baseKey}:user:${userId}` : baseKey; + } + + /** + * Simple wrapper for caching controller responses + */ + async withCache( + cacheKeyOrRequest: string | Request, + operation: () => Promise, + options: CacheOptions, + ): Promise { + // Try to get from cache first + const cached = await this.get(cacheKeyOrRequest); + if (cached) { + return cached; + } + + // Execute operation and cache result + const response = await operation(); + if (response.ok) { + await this.put(cacheKeyOrRequest, response.clone(), options); + } + + return response; + } +} diff --git a/worker/services/cache/decorators.ts b/worker/services/cache/decorators.ts new file mode 100644 index 00000000..ebf8f41d --- /dev/null +++ b/worker/services/cache/decorators.ts @@ -0,0 +1,64 @@ +/** + * Cacheable decorator for controller methods + */ + +import { CacheService } from './CacheService'; +import type { RouteContext } from '../../api/types/route-context'; + +interface CacheableOptions { + ttlSeconds: number; + tags?: string[]; + keyGenerator?: ( + request: Request, + context: RouteContext, + userId?: string, + ) => string | Request | Promise; +} + +/** + * Decorator to add caching to controller methods + */ +export function Cacheable(options: CacheableOptions) { + return function Promise>( + _target: unknown, + _propertyKey: string, + descriptor: TypedPropertyDescriptor, + ): TypedPropertyDescriptor { + const originalMethod = descriptor.value!; + const cacheService = new CacheService(); + + descriptor.value = (async function ( + this: unknown, + request: Request, + env: Env, + ctx: ExecutionContext, + context: RouteContext, + ): Promise { + // Generate cache key or use request directly + let userId = context?.user?.id; + + // For public endpoints, try to get optional user if not already available + if (!userId && (this as { getOptionalUser?: Function }).getOptionalUser) { + try { + const user = await (this as { getOptionalUser: Function }).getOptionalUser(request, env); + userId = user?.id; + } catch { + // Ignore auth errors for public endpoints + } + } + + const cacheKeyOrRequest = options.keyGenerator + ? await options.keyGenerator(request, context, userId) + : request; // Just use the request directly + + // Use cache wrapper + return cacheService.withCache( + cacheKeyOrRequest, + () => originalMethod.call(this, request, env, ctx, context), + { ttlSeconds: options.ttlSeconds, tags: options.tags }, + ); + }) as T; + + return descriptor; + }; +} diff --git a/worker/services/cache/wrapper.ts b/worker/services/cache/wrapper.ts new file mode 100644 index 00000000..accd8655 --- /dev/null +++ b/worker/services/cache/wrapper.ts @@ -0,0 +1,62 @@ +/** + * Cache wrapper for controller methods without decorators + */ + +import { CacheService } from './CacheService'; +import type { RouteContext } from '../../api/types/route-context'; +import type { BaseController } from '../../api/controllers/BaseController'; + +interface CacheOptions { + ttlSeconds: number; + tags?: string[]; +} + +type ControllerMethod = ( + this: T, + request: Request, + env: Env, + ctx: ExecutionContext, + context: RouteContext +) => Promise; + +/** + * Wraps a controller method with caching functionality + * Works without experimental decorators - pure higher-order function + */ +export function withCache( + method: ControllerMethod, + options: CacheOptions +): ControllerMethod { + const cacheService = new CacheService(); + + return async function ( + this: T, + request: Request, + env: Env, + ctx: ExecutionContext, + context: RouteContext + ): Promise { + // Try to get user for cache key differentiation + let userId = context?.user?.id; + + // For public endpoints, try to get optional user if not already available + if (!userId && 'getOptionalUser' in this && typeof this.getOptionalUser === 'function') { + try { + const user = await this.getOptionalUser(request, env); + userId = user?.id; + } catch { + // Ignore auth errors for public endpoints + } + } + + // Use request directly as cache key (Cloudflare Workers way) + const cacheKeyOrRequest = request; + + // Use cache wrapper + return cacheService.withCache( + cacheKeyOrRequest, + () => method.call(this, request, env, ctx, context), + { ttlSeconds: options.ttlSeconds, tags: options.tags } + ); + }; +} diff --git a/worker/services/sandbox/sandboxSdkClient.ts b/worker/services/sandbox/sandboxSdkClient.ts index abb1ab35..bcf401b3 100644 --- a/worker/services/sandbox/sandboxSdkClient.ts +++ b/worker/services/sandbox/sandboxSdkClient.ts @@ -780,22 +780,22 @@ export class SandboxSdkClient extends BaseSandboxService { } } - // TODO: REMOVE BEFORE PRODUCTION, SECURITY THREAT! Only for testing and demo - private async setLocalEnvVars(instanceId: string, localEnvVars: Record): Promise { - try { - const sandbox = this.getSandbox(); - // Simply save all env vars in '.dev.vars' file - const envVarsContent = Object.entries(localEnvVars) - .map(([key, value]) => `${key}=${value}`) - .join('\n'); - await sandbox.writeFile(`${instanceId}/.dev.vars`, envVarsContent); - } catch (error) { - this.logger.error(`Error setting local environment variables: ${error}`); - throw error; - } - } + // // TODO: REMOVE BEFORE PRODUCTION, SECURITY THREAT! Only for testing and demo + // private async setLocalEnvVars(instanceId: string, localEnvVars: Record): Promise { + // try { + // const sandbox = this.getSandbox(); + // // Simply save all env vars in '.dev.vars' file + // const envVarsContent = Object.entries(localEnvVars) + // .map(([key, value]) => `${key}=${value}`) + // .join('\n'); + // await sandbox.writeFile(`${instanceId}/.dev.vars`, envVarsContent); + // } catch (error) { + // this.logger.error(`Error setting local environment variables: ${error}`); + // throw error; + // } + // } - private async setupInstance(instanceId: string, projectName: string, localEnvVars?: Record): Promise<{previewURL: string, tunnelURL: string, processId: string, allocatedPort: number} | undefined> { + private async setupInstance(instanceId: string, projectName: string, _localEnvVars?: Record): Promise<{previewURL: string, tunnelURL: string, processId: string, allocatedPort: number} | undefined> { try { const sandbox = this.getSandbox(); // Update project configuration with the specified project name @@ -821,9 +821,9 @@ export class SandboxSdkClient extends BaseSandboxService { // Try to start development server in background try { // Set local environment variables if provided - if (localEnvVars) { - await this.setLocalEnvVars(instanceId, localEnvVars); - } + // if (localEnvVars) { + // await this.setLocalEnvVars(instanceId, localEnvVars); + // } // Setup git const gitSetupResult = await this.executeCommand(instanceId, `git init`); this.logger.info(`Git setup result: ${gitSetupResult.stdout}`); diff --git a/wrangler.jsonc b/wrangler.jsonc index 8160cbb5..01c5e231 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -47,7 +47,7 @@ "class_name": "UserAppSandboxService", "image": "./SandboxDockerfile", // Altering max_instances value will have no effect. Please use the MAX_SANDBOX_INSTANCES var instead. - "max_instances": 200, + "max_instances": 2900, // ATTENTION: Altering instance_type value will have no effect. Please use the SANDBOX_INSTANCE_TYPE var instead. "instance_type": { "vcpu": 4,