Moved from mongodb to sql and sqlite

This commit is contained in:
2024-04-09 21:59:52 +02:00
parent 27b01d0c36
commit ef5c531964
42 changed files with 1645 additions and 198 deletions

View File

@@ -5,10 +5,17 @@ import env from "utils/Env"
import { connect } from "mongoose"
import loadAllEvents from "./Events"
import { Player } from "discord-player"
import { Sequelize } from "sequelize"
const client = new Client()
const redis = new Redis(env.prod.redisURI!)
const player = new Player(client)
const sequelize = new Sequelize("illegitimate", "root", "password", {
host: "localhost",
dialect: "sqlite",
logging: false,
storage: "data/database.sqlite",
})
let ft: "js" | "ts"
if (process.env.NODE_ENV === "dev" && process.env.TYPESCRIPT === "true") {
@@ -33,6 +40,9 @@ class Illegitimate {
connect(env.prod.mongoURI!, {}).then(() => {
console.log(color("Connected to MongoDB", "green"))
})
sequelize.sync().then(() => {
console.log(color("Connected to SQLite", "green"))
})
}
private async init() {
@@ -54,4 +64,4 @@ class Illegitimate {
}
}
export { Illegitimate, client, redis }
export { Illegitimate, client, redis, sequelize }