Starting db migration file

This commit is contained in:
advplyr 2023-03-15 17:42:35 -05:00
parent b2e1e24ca5
commit c738e35a8c
14 changed files with 477 additions and 39 deletions

View file

@ -8,6 +8,10 @@ class Database {
this.sequelize = null
}
get models() {
return this.sequelize?.models || {}
}
async init() {
if (!await this.connect()) {
throw new Error('Database connection failed')
@ -49,6 +53,8 @@ class Database {
require('./models/LibraryFile')(this.sequelize)
require('./models/Person')(this.sequelize)
require('./models/AudioBookmark')(this.sequelize)
require('./models/MediaFile')(this.sequelize)
require('./models/MediaStream')(this.sequelize)
require('./models/AudioTrack')(this.sequelize)
require('./models/BookAuthor')(this.sequelize)
require('./models/BookChapter')(this.sequelize)
@ -71,8 +77,10 @@ class Database {
require('./models/FeedEpisode')(this.sequelize)
require('./models/Setting')(this.sequelize)
require('./models/LibrarySetting')(this.sequelize)
require('./models/Notification')(this.sequelize)
require('./models/UserPermission')(this.sequelize)
return this.sequelize.sync()
return this.sequelize.sync({ force: false })
}
async createTestUser() {