45 lines
969 B
TypeScript
45 lines
969 B
TypeScript
import { DataSource } from "typeorm";
|
|
import { ENVIRONMENT } from "../Modules/Constants";
|
|
import { Song } from "../Schemas/Song";
|
|
import { ForcedCategory } from "../Schemas/ForcedCategory";
|
|
import { User } from "../Schemas/User";
|
|
import { Rating } from "../Schemas/Rating";
|
|
|
|
export const DBSource = new DataSource({
|
|
type: "better-sqlite3",
|
|
database: `Partypack${ENVIRONMENT !== "prod" ? `-${ENVIRONMENT}` : ""}.db`,
|
|
synchronize: true,
|
|
logging: false,
|
|
entities: [
|
|
Song,
|
|
ForcedCategory,
|
|
User,
|
|
Rating
|
|
/*join(__dirname, "..", "Schemas") + "\\*{.js,.ts}"*/ // does not work in prod
|
|
],
|
|
subscribers: [],
|
|
migrations: [],
|
|
enableWAL: true
|
|
});
|
|
|
|
(async () => {
|
|
await DBSource.initialize();
|
|
})();
|
|
|
|
/*
|
|
User
|
|
- discord id (primary)
|
|
- list of all songs in user's library
|
|
- list of all songs in user's published
|
|
|
|
Song
|
|
- length
|
|
- bpm
|
|
- key
|
|
- scale
|
|
- keytar/guitar
|
|
- icon url
|
|
- name
|
|
- artist
|
|
- release year
|
|
*/ |