mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 02:36:31 -05:00
e641681483
Signed-off-by: David Mehren <dmehren1@gmail.com>
27 lines
774 B
TypeScript
27 lines
774 B
TypeScript
import { Sequelize } from 'sequelize-typescript'
|
|
import { cloneDeep } from 'lodash'
|
|
import { Author } from './author'
|
|
import { Note } from './note'
|
|
import { Revision } from './revision'
|
|
import { Temp } from './temp'
|
|
import { User } from './user'
|
|
import { logger } from '../logger'
|
|
import { config } from '../config'
|
|
|
|
const dbconfig = cloneDeep(config.db)
|
|
dbconfig.logging = config.debug ? (data): void => {
|
|
logger.info(data)
|
|
} : false
|
|
|
|
export let sequelize: Sequelize
|
|
|
|
// Heroku specific
|
|
if (config.dbURL) {
|
|
sequelize = new Sequelize(config.dbURL, dbconfig)
|
|
} else {
|
|
sequelize = new Sequelize(dbconfig.database, dbconfig.username, dbconfig.password, dbconfig)
|
|
}
|
|
|
|
sequelize.addModels([Author, Note, Revision, Temp, User])
|
|
|
|
export { Author, Note, Revision, Temp, User }
|