fixed migration issues

This commit is contained in:
dekzter 2025-05-18 11:53:09 -04:00
parent 74d58515d0
commit 79104affe3
3 changed files with 23 additions and 19 deletions

View file

@ -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),
]

View file

@ -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 = [

View file

@ -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",
),
),
]