-
-
Notifications
You must be signed in to change notification settings - Fork 231
fix(legacy): migrations from airtime 2.5.1 #3123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3123 +/- ##
===========================================
+ Coverage 70.36% 93.55% +23.18%
===========================================
Files 149 97 -52
Lines 4033 1521 -2512
===========================================
- Hits 2838 1423 -1415
+ Misses 1195 98 -1097
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
# Check to see if this is an airtime 2.5.1 migration which will not return a schema_version | ||
# We look for system_version to have a value of 2.5.1 | ||
with connection.cursor() as cursor: | ||
cursor.execute("SELECT valstr FROM cc_pref WHERE keystr = 'system_version'") | ||
row = cursor.fetchone() | ||
if row and row[0] == '2.5.1': | ||
return '0' # A low schema version that is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this in a single query? Maybe coalesce the schema version and the system version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest push consolidates this into a single query. get_schema_version returns the system_version if it is airtime 2.5.1, enough to prevent the database from being nuked/paved by 0001_initial.
…nt added clarifying purpose of empty migration
🤖 I have created a release *beep* *boop* --- ## [4.3.0](4.2.0...4.3.0) (2025-03-12) ### Features * add flac support to Web player ([#3128](#3128)) ([203c927](203c927)) * add Norwegian Bokmål locale ([#3073](#3073)) ([e614fbc](e614fbc)) * **analyzer:** parse comment fields from mp3 files ([#3082](#3082)) ([02a779b](02a779b)) * **api:** added filters on genre & md5 for files api ([#3127](#3127)) ([b1bdd6d](b1bdd6d)) * **api:** enable writes to schedule table ([#3109](#3109)) ([2ac7e8a](2ac7e8a)) * **legacy:** implement subset sum solution to show scheduling ([#3019](#3019)) ([5b5c68c](5b5c68c)), closes [#3018](#3018) * **legacy:** order by filename when lptime is null ([#3069](#3069)) ([8c26505](8c26505)) * **legacy:** show filename and size on edit page and add filename datatable column ([#3083](#3083)) ([16deaf0](16deaf0)), closes [#3053](#3053) * **legacy:** trused header sso auth ([#3095](#3095)) ([2985d85](2985d85)) * **legacy:** update deprecated PHP code ([#2789](#2789)) ([3a8dcbc](3a8dcbc)) * **playout:** add Liquidsoap 2.0 support ([#2786](#2786)) ([f9c0bd5](f9c0bd5)) * use custom intro/outro playlists per show ([#2941](#2941)) ([299be3c](299be3c)) ### Bug Fixes * add missing file for nb_NO locale ([#3075](#3075)) ([a3865aa](a3865aa)) * **analyzer:** make ffmpeg filters less aggressive ([#3086](#3086)) ([32cad0f](32cad0f)), closes [#2629](#2629) * docker warnings "keywords casing do not match" ([#3048](#3048)) ([e095cb2](e095cb2)) * intro/outro playlist unset was impossible ([#3101](#3101)) ([7992a9b](7992a9b)) * **legacy:** additional specifics added to CSVexport.js for RFC 4180 ([#3131](#3131)) ([644d2b9](644d2b9)), closes [#2477](#2477) * **legacy:** fix filename criteria searching ([#3068](#3068)) ([c883d0f](c883d0f)) * **legacy:** migrations from airtime 2.5.1 ([#3123](#3123)) ([82d5af2](82d5af2)) * **legacy:** support Postgresql 12 syntax ([#3103](#3103)) ([0b221f4](0b221f4)), closes [#3102](#3102) * **playout:** improve the way hashlib is called in libretime_playout/player ([#3135](#3135)) ([5b4c720](5b4c720)), closes [#3134](#3134) * regenerate API schema ([38a0bf9](38a0bf9)) * regenerate API schema ([ce257a1](ce257a1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Description
This fixes various problems in legacy migrations that were preventing a successful database migration from Airtime 2.5.1. Previously, following the procedure using the migrations provided in the Libretime 4.2.0 installer, without the fixes in this PR, would either fail completely, or cause all of the imported data to be completely deleted.
_migrations.py
If schema_version is not found in the table cc_prefs, it then checks for system_version to have a value of '2.5.1' (in case this is an airtime 2.5.1 migration which will not have any schema_version in cc_pref). If found, it prevents loading of the schema file, which is critical to preserving the imported Airtime data.
0006_2_5_5
Removed a redundant addition of the image_path and description columns to cc_show (done in earlier migration 003_2_5_2)
0015_2_5_17
Fixed a syntax error with adding the artwork column to cc_files
0023_3_0_0_alpha_9_1
Removed a redundant addition of the artwork column to cc_files (done in earlier migration 0015_2_5_7)
Documentation Changes
The airtime migration documentation already suggests a procedure to be followed, it just didn't work because of problems within these migrations. The procedure as documented should now work for those coming from Airtime 2.5.1.
Testing Notes
What I did:
I attempted to migrate an actual airtime 2.5.1 database from a production system containing a large amount of shows, tracks, and users. I observed that the migration completed without errors, and that the expected system state was achieved within Libretime. Specifically, the calendar, library, authentication, and other aspects are populated with the data that was present in the migrated Airtime database, and Libretime is able to function using this data.
How you can replicate my testing:
Install Libretime 4.2.0. Restore a sample postrgresql database backup from an Airtime 2.5.1 server. Apply the database migration. Restart the services. Login and view the library, calender, etc.
Links
Closes: #3121
May also be related to, or even close (as a duplicate): #2563