Files
starr-philproperties/database/migrations/20260712000001-add-audio-to-assets-file-type-enum.js
T
kennethobsequio e5e2580c7d keep trying
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
2026-07-12 14:49:08 +08:00

21 lines
912 B
JavaScript

'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() {},
};