-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorm.js
More file actions
48 lines (45 loc) · 1.4 KB
/
orm.js
File metadata and controls
48 lines (45 loc) · 1.4 KB
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
44
45
46
47
48
require("dotenv").config()
const typeorm = require("typeorm")
const dataSource = new typeorm.DataSource({
type: "mysql",
host: process.env.DB_HOST,
port: process.env.DB_PORT,
username: process.env.USER_NAME,
password: process.env.PASSWORD,
database: process.env.DATABASE,
synchronize: false,
logging: false,
entities: [
require("./entity/summoner.id"),
require("./entity/puuid"),
require("./entity/match.id"),
require("./entity/combination.data"),
require("./entity/simulation.data"),
require("./entity/simulation.service.data"),
require("./entity/champ.win.rate.data"),
require("./entity/champ.ban.data"),
require("./entity/champ.position.data"),
require("./entity/champ.spell.data"),
require("./entity/champ.spell.service.data"),
require("./entity/champ.service.data"),
],
})
// const puuidController = require("./data/puuId/puuId.controller")
module.exports = {
async connect() {
await dataSource
.initialize()
.then(function () {
console.log("분석용 연결 완료")
})
.catch(function (error) {
throw new Error(error)
})
},
async close() {
await dataSource.destroy().then(() => {
console.log("분석용 연결 해제")
})
},
dataSource,
}