-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
43 lines (37 loc) · 1.02 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* @author OA Wu <oawu.tw@gmail.com>
* @copyright Copyright (c) 2015 - 2025, @oawu/orm
* @license http://opensource.org/licenses/MIT MIT License
* @link https://www.ioa.tw/
*/
const { Config, Model, DB, Init, Migrate } = require('./index.js')
const { Type: T } = require('@oawu/helper')
const path = require('path')
// 設定連線方式
Config.connect = {
host: "db-mysql-8.3",
user: "root",
password: "1234",
database: "node-orm",
port: 3306,
waitForConnections: true,
connectionLimit: 3,
charset: 'utf8mb4'
}
// // Migration 檔案位置
Config.migrationsDir = __dirname + path.sep + 'Migrations' + path.sep
// Model 檔案位置
Config.modelsDir = __dirname + path.sep + 'Models' + path.sep
// // Log 檔案位置
Config.queryLogDir = __dirname + path.sep + 'Logs' + path.sep
Init()
.then(async _ => {
await require('./test-Migration.js')()
await require('./test-Model.js')()
})
.catch(_ => {
console.error('b', _);
})
.finally(async _ => {
await DB.close()
})