Add migration to include isDownloadable column in mediaItemShares table

This commit is contained in:
Greg Lorenzen 2024-12-01 01:49:50 +00:00
parent 9ef45686ac
commit 32850d13ec
2 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,32 @@
'use strict'
const { DataTypes } = require('sequelize')
/**
* @typedef MigrationContext
* @property {import('sequelize').QueryInterface} queryInterface - a Sequelize QueryInterface object.
* @property {import('../Logger')} logger - a Logger object.
*
* @typedef MigrationOptions
* @property {MigrationContext} context - an object containing the migration context.
*/
/**
* This migration script adds the isDownloadable column to the mediaItemShares table.
*
* @param {MigrationOptions} options - an object containing the migration context.
* @returns {Promise<void>} - A promise that resolves when the migration is complete.
*/
module.exports = {
up: async ({ context: { queryInterface, logger } }) => {
await queryInterface.addColumn('mediaItemShares', 'isDownloadable', {
type: DataTypes.BOOLEAN,
defaultValue: false,
allowNull: false
})
},
down: async ({ context: { queryInterface, logger } }) => {
await queryInterface.removeColumn('mediaItemShares', 'isDownloadable')
}
}