From e8a1ea3b541888f49c9809f40bb341f193dc085e Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sat, 19 Oct 2024 11:20:29 -0700 Subject: [PATCH] Fix: table naming --- server/migrations/v2.15.2-index-creation.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/migrations/v2.15.2-index-creation.js b/server/migrations/v2.15.2-index-creation.js index 8f5b9d52..b4490b3e 100644 --- a/server/migrations/v2.15.2-index-creation.js +++ b/server/migrations/v2.15.2-index-creation.js @@ -8,7 +8,7 @@ */ /** - * This upward migration script adds indexes to speed up queries on the `BookAuthor`, `BookSeries`, and `PodcastEpisode` tables. + * This upward migration script adds indexes to speed up queries on the `BookAuthor`, `BookSeries`, and `podcastEpisodes` tables. * * @param {MigrationOptions} options - an object containing the migration context. * @returns {Promise} - A promise that resolves when the migration is complete. @@ -19,23 +19,23 @@ async function up({ context: { queryInterface, logger } }) { // Create index for bookAuthors logger.info('[2.15.2 migration] Creating index for bookAuthors') - await queryInterface.addIndex('BookAuthor', ['authorId'], { + await queryInterface.addIndex('bookAuthors', ['authorId'], { name: 'bookAuthor_authorId' }) // Create index for bookSeries logger.info('[2.15.2 migration] Creating index for bookSeries') - await queryInterface.addIndex('BookSeries', ['seriesId'], { + await queryInterface.addIndex('bookSeries', ['seriesId'], { name: 'bookSeries_seriesId' }) // Delete existing podcastEpisode index logger.info('[2.15.2 migration] Deleting existing podcastEpisode index') - await queryInterface.removeIndex('PodcastEpisode', 'podcast_episode_created_at') + await queryInterface.removeIndex('podcastEpisodes', 'podcast_episode_created_at') // Create index for podcastEpisode and createdAt logger.info('[2.15.2 migration] Creating index for podcastEpisode and createdAt') - await queryInterface.addIndex('PodcastEpisode', ['createdAt', 'podcastId'], { + await queryInterface.addIndex('podcastEpisodes', ['createdAt', 'podcastId'], { name: 'podcastEpisode_createdAt_podcastId' }) @@ -44,7 +44,7 @@ async function up({ context: { queryInterface, logger } }) { } /** - * This downward migration script removes the newly created indexes and re-adds the old index on the `PodcastEpisode` table. + * This downward migration script removes the newly created indexes and re-adds the old index on the `podcastEpisodes` table. * * @param {MigrationOptions} options - an object containing the migration context. * @returns {Promise} - A promise that resolves when the migration is complete. @@ -55,19 +55,19 @@ async function down({ context: { queryInterface, logger } }) { // Remove index for bookAuthors logger.info('[2.15.2 migration] Removing index for bookAuthors') - await queryInterface.removeIndex('BookAuthor', 'bookAuthor_authorId') + await queryInterface.removeIndex('bookAuthors', 'bookAuthor_authorId') // Remove index for bookSeries logger.info('[2.15.2 migration] Removing index for bookSeries') - await queryInterface.removeIndex('BookSeries', 'bookSeries_seriesId') + await queryInterface.removeIndex('bookSeries', 'bookSeries_seriesId') // Delete existing podcastEpisode index logger.info('[2.15.2 migration] Deleting existing podcastEpisode index') - await queryInterface.removeIndex('PodcastEpisode', 'podcastEpisode_createdAt_podcastId') + await queryInterface.removeIndex('podcastEpisodes', 'podcastEpisode_createdAt_podcastId') // Create index for podcastEpisode and createdAt logger.info('[2.15.2 migration] Creating index for podcastEpisode createdAt') - await queryInterface.addIndex('PodcastEpisode', ['createdAt'], { + await queryInterface.addIndex('podcastEpisodes', ['createdAt'], { name: 'podcast_episode_created_at' })