1
0
mirror of https://github.com/daniviga/bite.git synced 2024-11-26 14:56:13 +01:00

Merge pull request #3 from daniviga/hyperscale

Convert Telemetry into an hyperscale table
This commit is contained in:
Daniele Viganò 2020-06-02 23:35:05 +02:00 committed by GitHub
commit 5768ed9390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 14 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.6 on 2020-06-02 21:28
import api.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20200601_1523'),
]
operations = [
migrations.AlterField(
model_name='device',
name='serial',
field=models.CharField(max_length=128, unique=True, validators=[api.models.device_validation]),
),
]

View File

@ -1,13 +0,0 @@
# Generated by Django 3.0.6 on 2020-06-01 17:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('telemetry', '0002_auto_20200601_1557'),
]
operations = [
]

View File

@ -0,0 +1,26 @@
# Generated by Django 3.0.6 on 2020-06-02 21:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('telemetry', '0002_auto_20200601_1557'),
]
operations = [
migrations.AlterModelOptions(
name='telemetry',
options={'ordering': ['time', 'device'], 'verbose_name_plural': 'Telemetry'},
),
migrations.RemoveField(
model_name='telemetry',
name='id',
),
migrations.AlterField(
model_name='telemetry',
name='time',
field=models.DateTimeField(auto_now_add=True, primary_key=True, serialize=False),
),
]

View File

@ -0,0 +1,15 @@
# Generated by Django 3.0.6 on 2020-06-02 21:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('telemetry', '0003_auto_20200602_2131'),
]
operations = [
migrations.RunSQL(
"SELECT create_hypertable('telemetry_telemetry', 'time');"),
]

View File

@ -6,7 +6,7 @@ from api.models import Device
class Telemetry(models.Model):
device = models.ForeignKey(Device, on_delete=models.CASCADE)
time = models.DateTimeField(auto_now_add=True)
time = models.DateTimeField(primary_key=True, auto_now_add=True)
payload = JSONField()
class Meta: