# Generated by Django 5.2.14 on 2026-05-27 import django.db.models.deletion import django.utils.timezone from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="AuditEvent", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("timestamp", models.DateTimeField(auto_now_add=True)), ("event_time", models.DateTimeField(default=django.utils.timezone.now)), ( "action", models.CharField( choices=[ ("admin_addition", "Admin addition"), ("admin_change", "Admin change"), ("admin_deletion", "Admin deletion"), ("user_pi_upgraded", "User upgraded to PI"), ("pi_status_revoked", "PI status revoked"), ( "user_admin_privileges_changed", "User admin privileges changed", ), ("allocation_requested", "Allocation created/requested"), ( "allocation_change_requested", "Allocation change requested", ), ( "allocation_status_changed", "Allocation status changed", ), ("allocation_disabled", "Allocation disabled"), ("renewal_requested", "Renewal requested"), ("renewal_approved", "Renewal approved"), ("allocation_renewed", "Allocation renewed"), ("project_user_added", "Project user added"), ("project_user_removed", "Project user removed"), ( "project_user_role_changed", "Project user role changed", ), ("project_created", "Project created"), ("project_archived", "Project archived"), ("project_deleted", "Project deleted"), ("project_status_changed", "Project status changed"), ("project_pi_changed", "Project PI changed"), ("project_review_forced", "Project review forced"), ( "project_review_submitted", "Project review submitted", ), ( "project_review_completed", "Project review completed", ), ( "project_review_status_changed", "Project review status changed", ), ("resource_created", "Resource created"), ("resource_changed", "Resource changed"), ("resource_deleted", "Resource deleted"), ], max_length=64, ), ), ( "evidence_category", models.CharField( blank=True, choices=[ ("AC-Access-Control", "AC - Access Control"), ( "AU-Audit-Accountability", "AU - Audit and Accountability", ), ( "AC-Access-Control; AU-Audit-Accountability", "AC/AU - Access and Audit", ), ( "CM-Configuration-Management", "CM - Configuration Management", ), ( "IA-Identification-Authentication", "IA - Identification and Authentication", ), ], max_length=128, ), ), ("control_family", models.CharField(blank=True, max_length=16)), ("target_type", models.CharField(blank=True, max_length=128)), ("target_id", models.CharField(blank=True, max_length=128)), ("target_repr", models.CharField(blank=True, max_length=255)), ("old_values", models.JSONField(blank=True, default=dict)), ("new_values", models.JSONField(blank=True, default=dict)), ("message", models.TextField(blank=True)), ( "source", models.CharField( choices=[ ("runtime", "Runtime"), ("django_admin", "Django admin"), ("coldfront_signal", "ColdFront signal"), ("coldfront_workflow", "ColdFront workflow"), ( "reconstructed_django_admin_log", "Reconstructed Django admin log", ), ("django_admin_log", "Django admin log"), ("coldfront_history", "ColdFront history"), ], default="runtime", max_length=64, ), ), ("source_id", models.CharField(blank=True, max_length=128)), ("is_reconstructed", models.BooleanField(default=False)), ("request_path", models.CharField(blank=True, max_length=255)), ("ip_address", models.GenericIPAddressField(blank=True, null=True)), ( "actor", models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="cmmc_audit_events", to=settings.AUTH_USER_MODEL, ), ), ], options={ "ordering": ["-timestamp"], "indexes": [ models.Index( fields=["event_time"], name="cmmc_audit__event_t_752462_idx" ), models.Index( fields=["action"], name="cmmc_audit__action_80997f_idx" ), models.Index( fields=["evidence_category"], name="cmmc_audit__evidenc_404a75_idx", ), models.Index( fields=["source"], name="cmmc_audit__source_21deb0_idx" ), models.Index( fields=["actor"], name="cmmc_audit__actor_i_6096a0_idx" ), models.Index( fields=["target_type", "target_id"], name="cmmc_audit__target__4e5508_idx", ), ], }, ), migrations.CreateModel( name="BackfillRun", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("name", models.CharField(max_length=128, unique=True)), ("started", models.DateTimeField(auto_now_add=True)), ("completed", models.DateTimeField(blank=True, null=True)), ("created_events", models.PositiveIntegerField(default=0)), ("dry_run", models.BooleanField(default=False)), ("notes", models.TextField(blank=True)), ], options={ "ordering": ["-started"], }, ), ]