123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- # Generated by Django 5.0.7 on 2024-07-12 14:55
- import django.contrib.postgres.search
- import django.db.models.deletion
- import psqlextra.backend.migrations.operations.add_default_partition
- import psqlextra.backend.migrations.operations.create_partitioned_model
- import psqlextra.manager.manager
- import psqlextra.models.partitioned
- import psqlextra.types
- import uuid
- from django.db import migrations, models
- from glitchtip.model_utils import TestDefaultPartition
- class Migration(migrations.Migration):
- initial = True
- dependencies = [
- ("performance", "0013_alter_transactionevent_options_and_more"),
- ("projects", "0015_rename_label_projectkey_name_projectkey_is_active"),
- ]
- operations = [
- psqlextra.backend.migrations.operations.create_partitioned_model.PostgresCreatePartitionedModel(
- name="TransactionEvent",
- fields=[
- (
- "event_id",
- models.UUIDField(
- default=uuid.uuid4,
- editable=False,
- primary_key=True,
- serialize=False,
- ),
- ),
- ("trace_id", models.UUIDField(db_index=True)),
- (
- "start_timestamp",
- models.DateTimeField(
- db_index=True,
- help_text="Datetime reported by client as the time the measurement started",
- ),
- ),
- (
- "timestamp",
- models.DateTimeField(
- blank=True,
- help_text="Datetime reported by client as the time the measurement finished",
- null=True,
- ),
- ),
- (
- "duration",
- models.PositiveIntegerField(
- db_index=True, help_text="Milliseconds"
- ),
- ),
- (
- "data",
- models.JSONField(help_text="General event data that is searchable"),
- ),
- ("tags", models.JSONField(default=dict)),
- ],
- options={
- "ordering": ["-start_timestamp"],
- },
- partitioning_options={
- "method": psqlextra.types.PostgresPartitioningMethod["RANGE"],
- "key": ["start_timestamp"],
- },
- bases=(psqlextra.models.partitioned.PostgresPartitionedModel,),
- managers=[
- ("objects", psqlextra.manager.manager.PostgresManager()),
- ],
- ),
- TestDefaultPartition(
- model_name="TransactionEvent",
- name="default",
- ),
- migrations.CreateModel(
- name="TransactionGroup",
- 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)),
- ("transaction", models.CharField(max_length=1024)),
- ("op", models.CharField(max_length=255)),
- ("method", models.CharField(blank=True, max_length=255, null=True)),
- ("tags", models.JSONField(default=dict)),
- (
- "search_vector",
- django.contrib.postgres.search.SearchVectorField(
- editable=False, null=True
- ),
- ),
- (
- "project",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to="projects.project",
- ),
- ),
- ],
- options={
- "unique_together": {("transaction", "project", "op", "method")},
- },
- ),
- migrations.AddField(
- model_name="transactionevent",
- name="group",
- field=models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to="performance.transactiongroup",
- ),
- ),
- ]
|