# Generated by Django 5.1.13 on 2025-10-15 19:05

from django.db import migrations, models


def migrate_messagetemplate_type(apps, schema_editor):
    """Convert the type to the new values.
    Reply and new message are now message type (1)."""
    MessageTemplate = apps.get_model('core', 'MessageTemplate')
    # Set new message type to message type value (1)
    MessageTemplate.objects.filter(type=2).update(type=1)
    # Set signature type to new value for signature type (2)
    MessageTemplate.objects.filter(type=3).update(type=2)


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0010_thread_has_archived_alter_user_language'),
    ]

    operations = [
        migrations.RunPython(migrate_messagetemplate_type, reverse_code=migrations.RunPython.noop),
        migrations.AlterField(
            model_name='messagetemplate',
            name='type',
            field=models.SmallIntegerField(choices=[(1, 'message'), (2, 'signature')], default=1, help_text='Type of template (message, signature)', verbose_name='type'),
        ),
    ]
