'use strict'; // The app has resolved/handled "audio" as a file_type since day one (see // resolveFileType() in assets.controller.js, ViewAudioAsset.jsx, // mediaToken.SUPPORTED_TYPES) but the enum itself was never extended past // the original ('avatar', 'document', 'video', 'image') — every audio // upload has been silently 500ing at Asset.create() with an invalid-enum // error. Discovered while adding batch asset uploads, which will hit this // path directly for any audio file dropped into a batch. module.exports = { async up(queryInterface) { await queryInterface.sequelize.query(`ALTER TYPE public.enum_assets_file_type ADD VALUE IF NOT EXISTS 'audio'`); }, // Postgres has no ALTER TYPE ... DROP VALUE — reverting an enum value // addition requires rebuilding the type, which isn't safe to do blindly // in a down migration if any row already uses 'audio'. async down() {}, };