@voscarmv/aimessagestore 1.0.3 → 1.0.4
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/package.json +1 -1
- package/src/server.ts +9 -1
package/package.json
CHANGED
package/src/server.ts
CHANGED
|
@@ -7,7 +7,11 @@ import cors from "cors";
|
|
|
7
7
|
import helmet from "helmet";
|
|
8
8
|
import morgan from "morgan";
|
|
9
9
|
import { and, asc, eq, sql } from "drizzle-orm";
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import { dirname } from 'path';
|
|
10
12
|
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
11
15
|
export interface StoreBackend {
|
|
12
16
|
migrate: () => void;
|
|
13
17
|
listen: () => void;
|
|
@@ -111,7 +115,11 @@ export class AiMessageStoreBackend implements StoreBackend {
|
|
|
111
115
|
);
|
|
112
116
|
}
|
|
113
117
|
async migrate() {
|
|
114
|
-
|
|
118
|
+
try {
|
|
119
|
+
await migrate(this.#db, { migrationsFolder: `${__dirname}/drizzle` });
|
|
120
|
+
} catch(e: any) {
|
|
121
|
+
console.log(e.message);
|
|
122
|
+
}
|
|
115
123
|
return;
|
|
116
124
|
}
|
|
117
125
|
listen() {
|