# Generated by Django 4.2.7 on 2023-11-18 16:47 from django.conf import settings import django.contrib.postgres.indexes import django.contrib.postgres.search from django.db import migrations, models import django.db.models.deletion import psqlextra.manager.manager import uuid class Migration(migrations.Migration): initial = True dependencies = [ ("projects", "0013_merge_20231017_1350"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="Issue", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("created", models.DateTimeField(auto_now_add=True)), ("culprit", models.CharField(blank=True, max_length=1024, null=True)), ("is_public", models.BooleanField(default=False)), ( "level", models.PositiveSmallIntegerField( choices=[ (0, "sample"), (1, "debug"), (2, "info"), (3, "warning"), (4, "error"), (5, "fatal"), ], default=4, ), ), ("metadata", models.JSONField()), ("title", models.CharField(max_length=255)), ( "type", models.PositiveSmallIntegerField( choices=[(0, "default"), (1, "error"), (2, "csp")], default=0 ), ), ( "status", models.PositiveSmallIntegerField( choices=[(0, "unresolved"), (1, "resolved"), (2, "ignored")], default=0, ), ), ("short_id", models.PositiveIntegerField(null=True)), ( "project", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="issues", to="projects.project", ), ), ], ), migrations.CreateModel( name="IssueHash", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("value", models.UUIDField(db_index=True)), ( "issue", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="hashes", to="issue_events.issue", ), ), ( "project", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="+", to="projects.project", ), ), ], ), migrations.CreateModel( name="IssueEvent", fields=[ ( "id", models.UUIDField( default=uuid.uuid4, editable=False, primary_key=True, serialize=False, ), ), ( "type", models.PositiveSmallIntegerField( choices=[(0, "default"), (1, "error"), (2, "csp")], default=0 ), ), ( "timestamp", models.DateTimeField(help_text="Time at which event happened"), ), ( "received", models.DateTimeField( help_text="Time at which GlitchTip accepted event" ), ), ("title", models.CharField(max_length=255)), ("transaction", models.CharField(max_length=200)), ( "level", models.PositiveSmallIntegerField( choices=[ (0, "sample"), (1, "debug"), (2, "info"), (3, "warning"), (4, "error"), (5, "fatal"), ], default=4, ), ), ("data", models.JSONField()), ("tags", models.JSONField()), ( "issue", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="issue_events.issue", ), ), ], options={ "abstract": False, "base_manager_name": "objects", }, managers=[ ("objects", psqlextra.manager.manager.PostgresManager()), ], ), migrations.CreateModel( name="Comment", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("created", models.DateTimeField(auto_now_add=True)), ("text", models.TextField(blank=True, null=True)), ( "issue", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="comments", to="issue_events.issue", ), ), ( "user", models.ForeignKey( null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="+", to=settings.AUTH_USER_MODEL, ), ), ], options={ "ordering": ("-created",), }, ), migrations.CreateModel( name="IssueStats", fields=[ ( "issue", models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to="issue_events.issue", ), ), ( "search_vector", django.contrib.postgres.search.SearchVectorField( editable=False, null=True ), ), ("search_vector_created", models.DateTimeField(auto_now_add=True)), ("count", models.PositiveIntegerField(default=1, editable=False)), ("last_seen", models.DateTimeField(auto_now_add=True, db_index=True)), ], options={ "indexes": [ django.contrib.postgres.indexes.GinIndex( fields=["search_vector"], name="issue_event_search__0754e8_gin" ) ], }, ), migrations.AddConstraint( model_name="issuehash", constraint=models.UniqueConstraint( fields=("project", "value"), name="issue hash project" ), ), migrations.AlterUniqueTogether( name="issue", unique_together={("project", "short_id")}, ), ]