mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-02 08:19:42 +00:00
Add Plugin model with migration
This commit is contained in:
parent
23b480b11a
commit
5a96d8aeb3
3 changed files with 116 additions and 0 deletions
48
server/models/Plugin.js
Normal file
48
server/models/Plugin.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
const { DataTypes, Model } = require('sequelize')
|
||||
|
||||
class Plugin extends Model {
|
||||
constructor(values, options) {
|
||||
super(values, options)
|
||||
|
||||
/** @type {UUIDV4} */
|
||||
this.id
|
||||
/** @type {string} */
|
||||
this.name
|
||||
/** @type {string} */
|
||||
this.version
|
||||
/** @type {Object} */
|
||||
this.config
|
||||
/** @type {Object} */
|
||||
this.extraData
|
||||
/** @type {Date} */
|
||||
this.createdAt
|
||||
/** @type {Date} */
|
||||
this.updatedAt
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize model
|
||||
* @param {import('../Database').sequelize} sequelize
|
||||
*/
|
||||
static init(sequelize) {
|
||||
super.init(
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
name: DataTypes.STRING,
|
||||
version: DataTypes.STRING,
|
||||
config: DataTypes.JSON,
|
||||
extraData: DataTypes.JSON
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'plugin'
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Plugin
|
||||
Loading…
Add table
Add a link
Reference in a new issue