mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-21 13:00:13 -06:00
Don't use auto_now_add; you can't override that
This commit is contained in:
17
ingest/migrations/0002_alter_decompressedevent_timestamp.py
Normal file
17
ingest/migrations/0002_alter_decompressedevent_timestamp.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('ingest', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='decompressedevent',
|
||||
name='timestamp',
|
||||
field=models.DateTimeField(default=django.utils.timezone.now, help_text='Server-side timestamp'),
|
||||
),
|
||||
]
|
||||
@@ -1,6 +1,7 @@
|
||||
import uuid
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
from projects.models import Project
|
||||
|
||||
@@ -10,4 +11,4 @@ class DecompressedEvent(models.Model): # or... DecompressedRawEvent
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
project = models.ForeignKey(Project, blank=False, null=True, on_delete=models.SET_NULL) # SET_NULL: cleanup 'later'
|
||||
data = models.TextField(blank=False, null=False)
|
||||
timestamp = models.DateTimeField(null=False, auto_now_add=True, help_text="Server-side timestamp")
|
||||
timestamp = models.DateTimeField(null=False, default=timezone.now, help_text="Server-side timestamp")
|
||||
|
||||
@@ -67,7 +67,7 @@ class BaseIngestAPIView(APIView):
|
||||
DecompressedEvent.objects.create(
|
||||
project=project,
|
||||
data=json.dumps(event_data), # TODO don't parse-then-print for BaseIngestion
|
||||
timestamp=now, # TODO this doesn't work because of auto_add_now
|
||||
timestamp=now,
|
||||
)
|
||||
|
||||
debug_info = request.META.get("HTTP_X_BUGSINK_DEBUGINFO", "")
|
||||
|
||||
Reference in New Issue
Block a user