{"id":17771,"library":"koishi-plugin-database-console","title":"Koishi Database Console","description":"koishi-plugin-database-console is a Koishi plugin designed to extend the Koishi Console with a graphical user interface for managing data stored via Minato, Koishi's universal database abstraction layer. It enables bot administrators to view and potentially manipulate their bot's underlying data directly within the Koishi web interface, abstracting away the need for external database management tools. Currently at version 0.2.3, this plugin operates within the active Koishi ecosystem, which generally sees frequent minor updates and periodic major version releases. Its primary differentiator is the seamless integration into the existing Koishi Console, offering a centralized management experience for chatbot operations and data. This allows for easier debugging, data inspection, and simplified administration, especially for those less familiar with direct database interaction.","status":"active","version":"0.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/koikirin/koishi-plugin-database-console","tags":["javascript","chatbot","koishi","plugin","typescript"],"install":[{"cmd":"npm install koishi-plugin-database-console","lang":"bash","label":"npm"},{"cmd":"yarn add koishi-plugin-database-console","lang":"bash","label":"yarn"},{"cmd":"pnpm add koishi-plugin-database-console","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the web console environment and services for plugin integration.","package":"@koishijs/plugin-console","optional":false},{"reason":"The core Koishi framework that this plugin extends.","package":"koishi","optional":false},{"reason":"Koishi's universal database abstraction layer, whose data this plugin helps manage.","package":"minato","optional":false}],"imports":[{"note":"Koishi plugins typically export an `apply` function (or a `Config` object) for registration, not a default export.","wrong":"import KoishiDatabaseConsole from 'koishi-plugin-database-console'","symbol":"apply","correct":"import { apply } from 'koishi-plugin-database-console'"},{"note":"Imports the plugin's configuration schema for type safety and console configuration.","symbol":"Config","correct":"import { Config } from 'koishi-plugin-database-console'"},{"note":"While Koishi supports CJS, plugins usually export `apply` via named export in ESM, making `require` without destructuring the entire module object more robust for CJS. For configuration, typically `koishi.config.ts` (ESM) is used.","wrong":"const { apply } = require('koishi-plugin-database-console')","symbol":"koishiPluginDatabaseConsole","correct":"const koishiPluginDatabaseConsole = require('koishi-plugin-database-console')"}],"quickstart":{"code":"import { Context, Schema } from 'koishi';\nimport { apply, Config } from 'koishi-plugin-database-console';\n\ninterface MyConfig extends Config {\n  // Add any specific configurations for koishi-plugin-database-console here\n  // For example, if it had a specific endpoint or permissions.\n  // This plugin usually doesn't require explicit configuration beyond enabling it.\n}\n\nexport const name = 'my-koishi-app';\n\nexport function apply(ctx: Context, config: MyConfig) {\n  // Apply the database console plugin.\n  // It automatically registers itself with the Koishi console.\n  ctx.plugin(apply, config);\n\n  ctx.logger('app').info('Koishi Database Console plugin applied!');\n\n  // Example of using Koishi's database context (Minato)\n  // This part is for demonstrating Minato, not directly the plugin.\n  ctx.model.extend('user', {\n    exampleData: { type: 'string' }\n  });\n\n  ctx.on('ready', async () => {\n    const user = await ctx.model.User.create({ id: '123', exampleData: 'Hello Minato!' });\n    ctx.logger('app').info(`Created example user: ${user.id} with data: ${user.exampleData}`);\n  });\n\n  // Register a simple command to show the bot is active\n  ctx.command('db.test', 'Test database console functionality (indirectly)')\n    .action(async ({ session }) => {\n      const user = await session.user.get();\n      return `Your exampleData in database: ${user.exampleData || 'N/A'}. Check the Koishi console for database views.`;\n    });\n}\n\nexport const Config: Schema<MyConfig> = Schema.object({});","lang":"typescript","description":"This quickstart demonstrates how to apply the koishi-plugin-database-console within a Koishi application and shows basic interaction with Koishi's Minato database layer. It assumes an existing Koishi project with a database configured."},"warnings":[{"fix":"Refer to the Koishi official documentation and the plugin's GitHub repository for specific migration guides or updated versions. Ensure all peer dependencies match the required Koishi ecosystem versions.","message":"Major version upgrades of the Koishi framework (e.g., Koishi v3 to v4) or its core console plugin (@koishijs/plugin-console) may introduce breaking changes requiring updates to this plugin. Always consult Koishi's official release notes.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure `@koishijs/plugin-console` is installed and enabled in your Koishi configuration. Access the Koishi console through your browser, usually at `http://localhost:8080` by default.","message":"This plugin requires a correctly configured and running Koishi console (`@koishijs/plugin-console`) to function. Without the console, the database UI will not be accessible.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Verify that your `minato` and database driver versions satisfy the peer dependency requirements of `koishi` and `koishi-plugin-database-console`. Update dependencies if necessary.","message":"Compatibility with the underlying database driver (e.g., `@minatojs/driver-sqlite`) and `minato` itself is crucial. Mismatched versions can lead to database connection errors or unexpected behavior.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Update your `@koishijs/plugin-console` package to match the required version using `npm install @koishijs/plugin-console@^5.29.4` or `yarn add @koishijs/plugin-console@^5.29.4`.","cause":"Peer dependency mismatch for `@koishijs/plugin-console`.","error":"Error: Plugin 'koishi-plugin-database-console' requires @koishijs/plugin-console@^5.29.4, got 5.x.x"},{"fix":"Ensure the package is installed: `npm install koishi-plugin-database-console` or `yarn add koishi-plugin-database-console`. Verify the import statement is `import { apply } from 'koishi-plugin-database-console'`.","cause":"The package is not installed or the import path is incorrect.","error":"Cannot find module 'koishi-plugin-database-console' or its corresponding type declarations."},{"fix":"Add `@koishijs/plugin-console` to your Koishi configuration file (e.g., `koishi.yml` or `koishi.config.ts`) and ensure it loads before `koishi-plugin-database-console` if there's an explicit ordering. Example in `koishi.config.ts`: `ctx.plugin(require('@koishijs/plugin-console'));`","cause":"The `@koishijs/plugin-console` plugin is not properly loaded or initialized in your Koishi application.","error":"TypeError: ctx.console is undefined (or similar error when accessing console features)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}