Outbox
This commit is contained in:
34
Main/migrations/0039_auto_20221013_1855.py
Normal file
34
Main/migrations/0039_auto_20221013_1855.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 3.2.4 on 2022-10-13 15:55
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('Main', '0038_auto_20220516_1836'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='OutboxMessage',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('queue', models.TextField()),
|
||||
('body', models.JSONField()),
|
||||
('time_created', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('time_sent', models.DateTimeField(default=None, null=True)),
|
||||
('time_received', models.DateTimeField(default=None, null=True)),
|
||||
('time_processed', models.DateTimeField(default=None, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='outboxmessage',
|
||||
index=models.Index(fields=['time_sent'], name='Main_outbox_time_se_4fc52a_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='outboxmessage',
|
||||
index=models.Index(fields=['time_sent', 'time_processed'], name='Main_outbox_time_se_edcbac_idx'),
|
||||
),
|
||||
]
|
@@ -11,3 +11,4 @@ from Main.models.solution_file import SolutionFile
|
||||
from Main.models.friendship import Friendship
|
||||
from Main.models.language_apply import LanguageApply
|
||||
from Main.models.dump import Dump
|
||||
from Main.models.outbox_message import OutboxMessage
|
||||
|
17
Main/models/outbox_message.py
Normal file
17
Main/models/outbox_message.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
class OutboxMessage(models.Model):
|
||||
queue = models.TextField()
|
||||
body = models.JSONField()
|
||||
time_created = models.DateTimeField(default=timezone.now)
|
||||
time_sent = models.DateTimeField(null=True, default=None)
|
||||
time_received = models.DateTimeField(null=True, default=None)
|
||||
time_processed = models.DateTimeField(null=True, default=None)
|
||||
|
||||
class Meta:
|
||||
indexes = [
|
||||
models.Index(fields=['time_sent']),
|
||||
models.Index(fields=['time_sent', 'time_processed'])
|
||||
]
|
Reference in New Issue
Block a user