@atri-bot/lib-db 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{definePlugin as e}from"@atri-bot/core";import{sql as t}from"drizzle-orm";import{drizzle as n}from"drizzle-orm/bun-sql";import{migrate as r}from"drizzle-orm/bun-sql/migrator";var i=`@atri-bot/lib-db`;let a=null;function o(r){return e({pluginName:`${i}-init-db`,async install(){try{await n(r.connectString,r.config??{}).execute(t`SELECT 1;`),a=r,this.logger.INFO(`测试数据库连接成功`)}catch(e){throw this.logger.ERROR(`测试数据库连接失败`,e),e}},uninstall(){}})}function s(t){if(!a)throw Error(`请先通过 InitDbPlugin 插件初始化数据库连接`);return e({pluginName:`${i}-db`,drizzle:n(a.connectString,{...a.config,...t.config}),async install(){t.migration&&await r(this.drizzle,t.migration)},uninstall(){}})}export{s as DbPlugin,o as InitDbPlugin};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atri-bot/lib-db",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"description": "db lib for atri framework",
|
|
6
6
|
"author": "huan_kong",
|
|
7
7
|
"license": "MIT",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"typecheck": "tsc --noEmit -p tsconfig.json --composite false"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atri-bot/core": "^2.0.
|
|
19
|
+
"@atri-bot/core": "^2.0.2",
|
|
20
20
|
"@huan_kong/logger": "^2.0.2",
|
|
21
21
|
"drizzle-orm": "^1.0.0-beta.19"
|
|
22
22
|
}
|