mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-07 09:51:37 +00:00
add database changes for recommandation sent and inbox
This commit is contained in:
parent
649f40ff37
commit
ae4bd94b38
1 changed files with 20 additions and 2 deletions
|
|
@ -161,7 +161,12 @@ class Database {
|
|||
get deviceModel() {
|
||||
return this.models.device
|
||||
}
|
||||
|
||||
get recommendationTagModel() {
|
||||
return this.models.recommendationTag
|
||||
}
|
||||
get bookRecommendationModel() {
|
||||
return this.models.bookRecommendation
|
||||
}
|
||||
/**
|
||||
* Check if db file exists
|
||||
* @returns {boolean}
|
||||
|
|
@ -345,8 +350,21 @@ class Database {
|
|||
require('./models/Setting').init(this.sequelize)
|
||||
require('./models/CustomMetadataProvider').init(this.sequelize)
|
||||
require('./models/MediaItemShare').init(this.sequelize)
|
||||
|
||||
require('./models/RecommendationTag').init(this.sequelize)
|
||||
require('./models/BookRecommendation').init(this.sequelize)
|
||||
// One-time association pass (no swallowing of errors)
|
||||
const models = this.sequelize.models
|
||||
Object.values(models).forEach((m) => {
|
||||
if (typeof m?.associate === 'function') m.associate(models)
|
||||
})
|
||||
return this.sequelize.sync({ force, alter: false })
|
||||
// single association pass
|
||||
Object.values(this.sequelize.models).forEach((m) => {
|
||||
if (m?.associate)
|
||||
try {
|
||||
m.associate(this.sequelize.models)
|
||||
} catch (_) {}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue