From 1cc75a94ef3942a766fab8cdec8f0165eb2a1923 Mon Sep 17 00:00:00 2001 From: X4Lo Date: Mon, 20 Apr 2026 20:25:04 +0100 Subject: [PATCH] backend: removed migrateAccuracyField() function as it was temporary. --- backend/config/dataInitializer.js | 102 +++++++++++++++--------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/backend/config/dataInitializer.js b/backend/config/dataInitializer.js index 2a9628b..30a1756 100644 --- a/backend/config/dataInitializer.js +++ b/backend/config/dataInitializer.js @@ -7,29 +7,29 @@ const Media = require("../models/Media"); async function initializeData() { initializeGenres(); - migrateAccuracyField(); + // migrateAccuracyField(); } - // const collections = await Collection.findAll({ - // where: { - // posterPath: { [Sequelize.Op.notLike]: '/%' } - // } - // }); +// const collections = await Collection.findAll({ +// where: { +// posterPath: { [Sequelize.Op.notLike]: '/%' } +// } +// }); - // collections.forEach(collection => { - // Media.create({ - // mediaable: 'collection', - // mediaableId: collection.id, - // type: 'poster', - // path: collection.posterPath, - // isLocal: true, - // isSelected: true - // }) - // }); +// collections.forEach(collection => { +// Media.create({ +// mediaable: 'collection', +// mediaableId: collection.id, +// type: 'poster', +// path: collection.posterPath, +// isLocal: true, +// isSelected: true +// }) +// }); - // console.log(collections); -} +// console.log(collections); +// } async function initializeGenres() { try { @@ -88,38 +88,38 @@ module.exports = { initializeGenres, } -async function migrateAccuracyField() { - try { - const qi = sequelize.getQueryInterface(); +// async function migrateAccuracyField() { +// try { +// const qi = sequelize.getQueryInterface(); - // Add accuracy column to entrySeens if it doesn't exist - const entrySeenColumns = await qi.describeTable('entrySeens'); - if (!entrySeenColumns.accuracy) { - await qi.addColumn('entrySeens', 'accuracy', { - type: Sequelize.ENUM('EXACT', 'ESTIMATED', 'UNKNOWN'), - defaultValue: 'EXACT', - }); - // Set all existing records to EXACT - await sequelize.query(`UPDATE entrySeens SET accuracy = 'EXACT' WHERE accuracy IS NULL`); - // Set records with date_seen = 2021-01-01 to UNKNOWN - await sequelize.query(`UPDATE entrySeens SET accuracy = 'UNKNOWN' WHERE DATE(date_seen) = '2021-01-01'`); - console.log('Migrated accuracy field on entrySeens'); - } +// // Add accuracy column to entrySeens if it doesn't exist +// const entrySeenColumns = await qi.describeTable('entrySeens'); +// if (!entrySeenColumns.accuracy) { +// await qi.addColumn('entrySeens', 'accuracy', { +// type: Sequelize.ENUM('EXACT', 'ESTIMATED', 'UNKNOWN'), +// defaultValue: 'EXACT', +// }); +// // Set all existing records to EXACT +// await sequelize.query(`UPDATE entrySeens SET accuracy = 'EXACT' WHERE accuracy IS NULL`); +// // Set records with date_seen = 2021-01-01 to UNKNOWN +// await sequelize.query(`UPDATE entrySeens SET accuracy = 'UNKNOWN' WHERE DATE(date_seen) = '2021-01-01'`); +// console.log('Migrated accuracy field on entrySeens'); +// } - // Add accuracy column to episodeSeens if it doesn't exist - const episodeSeenColumns = await qi.describeTable('episodeSeens'); - if (!episodeSeenColumns.accuracy) { - await qi.addColumn('episodeSeens', 'accuracy', { - type: Sequelize.ENUM('EXACT', 'ESTIMATED', 'UNKNOWN'), - defaultValue: 'EXACT', - }); - // Set all existing records to EXACT - await sequelize.query(`UPDATE episodeSeens SET accuracy = 'EXACT' WHERE accuracy IS NULL`); - // Set records with date_seen = 2020-01-01 to UNKNOWN - await sequelize.query(`UPDATE episodeSeens SET accuracy = 'UNKNOWN' WHERE DATE(date_seen) = '2020-01-01'`); - console.log('Migrated accuracy field on episodeSeens'); - } - } catch (error) { - console.error('Error migrating accuracy field:', error); - } -} +// // Add accuracy column to episodeSeens if it doesn't exist +// const episodeSeenColumns = await qi.describeTable('episodeSeens'); +// if (!episodeSeenColumns.accuracy) { +// await qi.addColumn('episodeSeens', 'accuracy', { +// type: Sequelize.ENUM('EXACT', 'ESTIMATED', 'UNKNOWN'), +// defaultValue: 'EXACT', +// }); +// // Set all existing records to EXACT +// await sequelize.query(`UPDATE episodeSeens SET accuracy = 'EXACT' WHERE accuracy IS NULL`); +// // Set records with date_seen = 2020-01-01 to UNKNOWN +// await sequelize.query(`UPDATE episodeSeens SET accuracy = 'UNKNOWN' WHERE DATE(date_seen) = '2020-01-01'`); +// console.log('Migrated accuracy field on episodeSeens'); +// } +// } catch (error) { +// console.error('Error migrating accuracy field:', error); +// } +// }