libretime/api/libretime_api/legacy/migrations
Scott McGrath 82d5af2dfb
fix(legacy): migrations from airtime 2.5.1 (#3123)
### Description

This fixes various problems in legacy migrations that were preventing a
successful database migration from Airtime 2.5.1. Previously, following
[the
procedure](https://libretime.org/docs/admin-manual/install/migrate-from-airtime/)
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](https://libretime.org/docs/admin-manual/install/migrate-from-airtime/)
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
2024-12-21 10:09:19 +00:00
..
sql fix: intro/outro playlist unset was impossible (#3101) 2024-10-21 18:34:39 +01:00
0001_initial.py chore(api): fix linting errors 2022-06-26 16:13:47 +02:00
0003_2_5_2.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0004_2_5_3.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0005_2_5_4.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0006_2_5_5.py fix(legacy): migrations from airtime 2.5.1 (#3123) 2024-12-21 10:09:19 +00:00
0007_2_5_9.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0008_2_5_10.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0009_2_5_11.py chore(api): fix linting errors 2022-06-26 16:13:47 +02:00
0010_2_5_12.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0011_2_5_13.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0012_2_5_14.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0013_2_5_15.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0014_2_5_16.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0015_2_5_17.py fix(legacy): migrations from airtime 2.5.1 (#3123) 2024-12-21 10:09:19 +00:00
0016_3_0_0_alpha.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0017_3_0_0_alpha_1.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0018_3_0_0_alpha_6.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0019_3_0_0_alpha_7.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0020_3_0_0_alpha_7_1.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0021_3_0_0_alpha_7_2.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0022_3_0_0_alpha_7_3.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0023_3_0_0_alpha_9_1.py fix(legacy): migrations from airtime 2.5.1 (#3123) 2024-12-21 10:09:19 +00:00
0024_3_0_0_alpha_9_2.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0025_3_0_0_alpha_9_3.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0026_3_0_0_alpha_9_4.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0027_3_0_0_alpha_13_1.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0028_3_0_0_alpha_13_2.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0029_3_0_0_alpha_13_3.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0030_3_0_0_alpha_13_4.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0031_3_0_0_alpha_13_5.py chore(api): disable some linting rule 2022-06-22 13:37:17 +02:00
0032_3_0_0_alpha_13_6.py fix(api): cascade when dropping table (#1908) 2022-06-22 16:08:05 +02:00
0033_3_0_0_alpha_13_7.py feat: remove unused cc_perms table (#1909) 2022-06-22 16:32:39 +02:00
0034_3_0_0_alpha_13_8.py chore: remove cloud storage remainings (#1934) 2022-07-04 22:09:14 +02:00
0035_3_0_0_alpha_13_9.py fix: use track_type_id in smartblock criteria 2022-07-12 11:32:26 +02:00
0036_3_0_0_alpha_13_10.py feat: remove unused cc_country table 2022-07-12 11:33:22 +02:00
0037_move_stream_settings_to_preferences.py chore(api): rename legacy migration files 2022-09-15 17:11:01 +02:00
0038_remove_stream_settings_liquidsoap_status.py chore(api): rename legacy migration files 2022-09-15 17:11:01 +02:00
0039_remove_stream_settings_stats_status.py chore(api): rename legacy migration files 2022-09-15 17:11:01 +02:00
0040_bump_legacy_schema_version.py chore: bump legacy schema version 2022-09-15 17:11:01 +02:00
0041_drop_stream_setting_table.py feat: drop cc_stream_setting table 2022-10-11 11:32:51 +02:00
0042_remove_stream_preferences.py feat: delete cc_pref stream preferences rows 2022-10-11 11:32:51 +02:00
0043_remove_cors_preference.py feat(legacy): remove db allowed_cors_origins preference (#2095) 2022-10-11 13:38:31 +02:00
0044_add_track_types_analyzer_options.py cuepoints analyzer disabled by default 2023-02-15 10:13:32 +02:00
0045_add_sessions_table.py feat(legacy): move session store to database (#2523) 2023-05-30 22:25:50 +02:00
0046_add_override_intro_outro_playlists.py fix: intro/outro playlist unset was impossible (#3101) 2024-10-21 18:34:39 +01:00
__init__.py feat: use custom intro/outro playlists per show (#2941) 2024-10-14 21:07:41 +01:00
_migrations.py fix(legacy): migrations from airtime 2.5.1 (#3123) 2024-12-21 10:09:19 +00:00
_version.py chore: raise from specific exceptions 2023-02-03 07:36:58 +02:00