[Bug]: Migration Manager not recognizing migrations from before current version #2254

Closed
opened 2026-04-25 00:05:31 +02:00 by adam · 0 comments
Owner

Originally created by @nichwall on GitHub (Sep 13, 2024).

What happened?

I am working on getting my first migration written (for the series duplication bug). Upgrading a database from 2.12.3 to 2.13.4 with a test migration occurring in 2.13.2 does not run the migration script. I assume this is because the migrationMeta table is being created with the current server version, so the migration manager sees the newly created table as having the same value as the current server version.

This may cause problems with future upgrades, or if people are upgrading from older server versions to a version after a migration occurred.

I am basing the migration script soley off of the README in the migrations folder, so I could be doing something wrong with the version numbers in my testing.

What did you expect to happen?

All migration scripts to run between previous and current version when creation of migrationsMeta table. When creating the table, the "old version" can be assumed to be 2.13.4 or similar.

Manually editing the versions in the table and then running the server again does correctly run the migration.

Steps to reproduce the issue

  1. Use older database
  2. Create migration script that targets a version between old database and current server version, without having upgraded to a server version that has the MigrationManager
  3. Observe migration script does not run

Audiobookshelf version

v2.13.4-edge

How are you running audiobookshelf?

Built from source

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

[2024-09-13 10:58:04.236] INFO: [MigrationManager] Database is already up to date.
[2024-09-13 10:58:04.346] INFO: [Database] Db initialized with models: user, library, libraryFolder, book, podcast, podcastEpisode, libraryItem, mediaProgress, series, bookSeries, author, bookAuthor, collection, collectionBook, playlist, playlistMediaItem, device, playbackSession, feed, feedEpisode, setting, customMetadataProvider, mediaItemShare
[2024-09-13 10:58:04.351] DEBUG: Set Log Level to DEBUG
[2024-09-13 10:58:04.373] INFO: [Database] Server upgrade detected from 2.12.3 to 2.13.4

Additional Notes

No response

Originally created by @nichwall on GitHub (Sep 13, 2024). ### What happened? I am working on getting my first migration written (for the series duplication bug). Upgrading a database from `2.12.3` to `2.13.4` with a test migration occurring in `2.13.2` does not run the migration script. I assume this is because the `migrationMeta` table is being created with the current server version, so the migration manager sees the newly created table as having the same value as the current server version. This may cause problems with future upgrades, or if people are upgrading from older server versions to a version after a migration occurred. I am basing the migration script soley off of the README in the migrations folder, so I could be doing something wrong with the version numbers in my testing. ### What did you expect to happen? All migration scripts to run between previous and current version when creation of `migrationsMeta` table. When creating the table, the "old version" can be assumed to be `2.13.4` or similar. Manually editing the versions in the table and then running the server again does correctly run the migration. ### Steps to reproduce the issue 1. Use older database 2. Create migration script that targets a version between old database and current server version, without having upgraded to a server version that has the `MigrationManager` 3. Observe migration script does not run ### Audiobookshelf version v2.13.4-edge ### How are you running audiobookshelf? Built from source ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell [2024-09-13 10:58:04.236] INFO: [MigrationManager] Database is already up to date. [2024-09-13 10:58:04.346] INFO: [Database] Db initialized with models: user, library, libraryFolder, book, podcast, podcastEpisode, libraryItem, mediaProgress, series, bookSeries, author, bookAuthor, collection, collectionBook, playlist, playlistMediaItem, device, playbackSession, feed, feedEpisode, setting, customMetadataProvider, mediaItemShare [2024-09-13 10:58:04.351] DEBUG: Set Log Level to DEBUG [2024-09-13 10:58:04.373] INFO: [Database] Server upgrade detected from 2.12.3 to 2.13.4 ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:05:31 +02:00
adam closed this issue 2026-04-25 00:05:31 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2254