mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-09 02:41:35 +00:00
Added server wide audiobook rating (admin only)
This commit is contained in:
parent
d21fe49ce2
commit
7c3504fe2b
10 changed files with 312 additions and 18 deletions
58
server/migrations/v2.25.2-add-book-ratings.js
Normal file
58
server/migrations/v2.25.2-add-book-ratings.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
const { DataTypes } = require('sequelize')
|
||||
|
||||
module.exports = {
|
||||
up: async ({ context: queryInterface }) => {
|
||||
const transaction = await queryInterface.sequelize.transaction()
|
||||
try {
|
||||
await queryInterface.addColumn(
|
||||
'books',
|
||||
'rating',
|
||||
{
|
||||
type: DataTypes.FLOAT
|
||||
},
|
||||
{ transaction }
|
||||
)
|
||||
await queryInterface.addColumn(
|
||||
'books',
|
||||
'providerRating',
|
||||
{
|
||||
type: DataTypes.FLOAT
|
||||
},
|
||||
{ transaction }
|
||||
)
|
||||
await queryInterface.addColumn(
|
||||
'books',
|
||||
'provider',
|
||||
{
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
{ transaction }
|
||||
)
|
||||
await queryInterface.addColumn(
|
||||
'books',
|
||||
'providerId',
|
||||
{
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
{ transaction }
|
||||
)
|
||||
await transaction.commit()
|
||||
} catch (err) {
|
||||
await transaction.rollback()
|
||||
throw err
|
||||
}
|
||||
},
|
||||
down: async ({ context: queryInterface }) => {
|
||||
const transaction = await queryInterface.sequelize.transaction()
|
||||
try {
|
||||
await queryInterface.removeColumn('books', 'rating', { transaction })
|
||||
await queryInterface.removeColumn('books', 'providerRating', { transaction })
|
||||
await queryInterface.removeColumn('books', 'provider', { transaction })
|
||||
await queryInterface.removeColumn('books', 'providerId', { transaction })
|
||||
await transaction.commit()
|
||||
} catch (err) {
|
||||
await transaction.rollback()
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue