From 79104affe3c85bb3d299d0efccf94669421d5c0b Mon Sep 17 00:00:00 2001 From: dekzter Date: Sun, 18 May 2025 11:53:09 -0400 Subject: [PATCH] fixed migration issues --- ...l_groups_user_channel_profiles_and_more.py | 12 ++++------ .../migrations/0003_create_custom_account.py | 7 ++++-- ...5_m3uaccount_custom_properties_and_more.py | 23 +++++++++++-------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/apps/accounts/migrations/0002_remove_user_channel_groups_user_channel_profiles_and_more.py b/apps/accounts/migrations/0002_remove_user_channel_groups_user_channel_profiles_and_more.py index 63077463..43ad63db 100644 --- a/apps/accounts/migrations/0002_remove_user_channel_groups_user_channel_profiles_and_more.py +++ b/apps/accounts/migrations/0002_remove_user_channel_groups_user_channel_profiles_and_more.py @@ -1,12 +1,10 @@ -# Generated by Django 5.1.6 on 2025-05-13 16:59 +# Generated by Django 5.1.6 on 2025-05-18 15:47 from django.db import migrations, models def set_user_level_to_10(apps, schema_editor): - User = apps.get_model( - "accounts", "User" - ) # Use 'auth' if you're using the default User model + User = apps.get_model("accounts", "User") User.objects.update(user_level=10) @@ -14,7 +12,7 @@ class Migration(migrations.Migration): dependencies = [ ("accounts", "0001_initial"), - ("dispatcharr_channels", "0019_channel_tvc_guide_stationid"), + ("dispatcharr_channels", "0021_channel_user_level"), ] operations = [ @@ -34,9 +32,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name="user", name="user_level", - field=models.IntegerField( - choices=[(0, "Streamer"), (1, "ReadOnly"), (10, "Admin")], default=0 - ), + field=models.IntegerField(default=0), ), migrations.RunPython(set_user_level_to_10), ] diff --git a/apps/m3u/migrations/0003_create_custom_account.py b/apps/m3u/migrations/0003_create_custom_account.py index 8695f248..cdc40cda 100644 --- a/apps/m3u/migrations/0003_create_custom_account.py +++ b/apps/m3u/migrations/0003_create_custom_account.py @@ -3,6 +3,7 @@ from django.db import migrations from core.models import CoreSettings + def create_custom_account(apps, schema_editor): default_user_agent_id = CoreSettings.get_default_user_agent_id() @@ -18,7 +19,7 @@ def create_custom_account(apps, schema_editor): M3UAccountProfile = apps.get_model("m3u", "M3UAccountProfile") M3UAccountProfile.objects.create( m3u_account=m3u_account, - name=f'{m3u_account.name} Default', + name=f"{m3u_account.name} Default", max_streams=m3u_account.max_streams, is_default=True, is_active=True, @@ -26,10 +27,12 @@ def create_custom_account(apps, schema_editor): replace_pattern="$1", ) + class Migration(migrations.Migration): dependencies = [ - ('m3u', '0002_m3uaccount_locked'), + ("m3u", "0002_m3uaccount_locked"), + ("core", "0004_preload_core_settings"), ] operations = [ diff --git a/apps/m3u/migrations/0005_m3uaccount_custom_properties_and_more.py b/apps/m3u/migrations/0005_m3uaccount_custom_properties_and_more.py index 3728bf7f..7a5f2013 100644 --- a/apps/m3u/migrations/0005_m3uaccount_custom_properties_and_more.py +++ b/apps/m3u/migrations/0005_m3uaccount_custom_properties_and_more.py @@ -7,24 +7,29 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('django_celery_beat', '0019_alter_periodictasks_options'), - ('m3u', '0004_m3uaccount_stream_profile'), + ("django_celery_beat", "0019_alter_periodictasks_options"), + ("m3u", "0004_m3uaccount_stream_profile"), ] operations = [ migrations.AddField( - model_name='m3uaccount', - name='custom_properties', + model_name="m3uaccount", + name="custom_properties", field=models.TextField(blank=True, null=True), ), migrations.AddField( - model_name='m3uaccount', - name='refresh_interval', + model_name="m3uaccount", + name="refresh_interval", field=models.IntegerField(default=24), ), migrations.AddField( - model_name='m3uaccount', - name='refresh_task', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='django_celery_beat.periodictask'), + model_name="m3uaccount", + name="refresh_task", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="django_celery_beat.periodictask", + ), ), ]