123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- # Generated by Django 4.2.8 on 2023-12-27 19:06
- 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')),
- ('is_deleted', models.BooleanField(default=False)),
- ('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)),
- ('search_vector', django.contrib.postgres.search.SearchVectorField(default='', editable=False)),
- ('count', models.PositiveIntegerField(default=1, editable=False)),
- ('first_seen', models.DateTimeField(db_index=True)),
- ('last_seen', models.DateTimeField(db_index=True)),
- ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='issues', to='projects.project')),
- ],
- options={
- 'base_manager_name': 'objects',
- },
- ),
- 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='UserReport',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
- ('event_id', models.UUIDField()),
- ('name', models.CharField(max_length=128)),
- ('email', models.EmailField(max_length=254)),
- ('comments', models.TextField()),
- ('issue', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='issue_events.issue')),
- ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='projects.project')),
- ],
- options={
- 'unique_together': {('project', 'event_id')},
- },
- ),
- migrations.AddConstraint(
- model_name='issuehash',
- constraint=models.UniqueConstraint(fields=('project', 'value'), name='issue hash project'),
- ),
- migrations.AddIndex(
- model_name='issue',
- index=django.contrib.postgres.indexes.GinIndex(fields=['search_vector'], name='issue_event_search__346c17_gin'),
- ),
- migrations.AlterUniqueTogether(
- name='issue',
- unique_together={('project', 'short_id')},
- ),
- ]
|