# Generated by Django 5.1.5 on 2025-02-20 13:25

import access.fields
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('access', '0003_alter_team_organization_organizationnotes_teamnotes'),
        ('contenttypes', '0002_remove_content_type_name'),
        ('core', '0014_data_move_notes_to_new_table'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ModelHistory',
            fields=[
                ('id', models.AutoField(help_text='ID of the item', primary_key=True, serialize=False, unique=True, verbose_name='ID')),
                ('is_global', models.BooleanField(default=False, help_text='Is this a global object?', verbose_name='Global Object')),
                ('before', models.JSONField(blank=True, default=None, help_text='JSON Object before Change', null=True, verbose_name='Before')),
                ('after', models.JSONField(blank=True, default=None, help_text='JSON Object After Change', null=True, verbose_name='After')),
                ('action', models.IntegerField(choices=[(1, 'Create'), (2, 'Update'), (3, 'Delete')], default=None, help_text='History action performed', null=True, verbose_name='Action')),
                ('created', access.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, help_text='Date and time of creation', verbose_name='Created')),
                ('content_type', models.ForeignKey(blank=True, help_text='Model this note is for', on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype', verbose_name='Content Model')),
                ('organization', models.ForeignKey(help_text='Organization this belongs to', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='access.organization', verbose_name='Organization')),
                ('user', models.ForeignKey(help_text='User whom performed the action this history relates to', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'History',
                'verbose_name_plural': 'History',
                'db_table': 'core_model_history',
                'ordering': ['-created'],
            },
        ),
        migrations.CreateModel(
            name='ManufacturerHistory',
            fields=[
                ('modelhistory_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelhistory')),
                ('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='history', to='core.manufacturer', verbose_name='Model')),
            ],
            options={
                'verbose_name': 'Manufacturer History',
                'verbose_name_plural': 'Manufacturer History',
                'db_table': 'core_manufacturer_history',
                'ordering': ['-created'],
            },
            bases=('core.modelhistory',),
        ),
        migrations.CreateModel(
            name='TicketCategoryHistory',
            fields=[
                ('modelhistory_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelhistory')),
                ('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='history', to='core.ticketcategory', verbose_name='Model')),
            ],
            options={
                'verbose_name': 'Ticket Category History',
                'verbose_name_plural': 'Ticket Category History',
                'db_table': 'core_ticketcategory_history',
                'ordering': ['-created'],
            },
            bases=('core.modelhistory',),
        ),
        migrations.CreateModel(
            name='TicketCommentCategoryHistory',
            fields=[
                ('modelhistory_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.modelhistory')),
                ('model', models.ForeignKey(help_text='Model this note belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='history', to='core.ticketcommentcategory', verbose_name='Model')),
            ],
            options={
                'verbose_name': 'Ticket Comment Category History',
                'verbose_name_plural': 'Ticket Comment Category History',
                'db_table': 'core_ticketcommentcategory_history',
                'ordering': ['-created'],
            },
            bases=('core.modelhistory',),
        ),
    ]
