mirror of
https://github.com/daniviga/bite.git
synced 2024-11-26 23:06:14 +01:00
Merge pull request #3 from daniviga/hyperscale
Convert Telemetry into an hyperscale table
This commit is contained in:
commit
5768ed9390
19
freedcs/api/migrations/0003_auto_20200602_2128.py
Normal file
19
freedcs/api/migrations/0003_auto_20200602_2128.py
Normal 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]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -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 = [
|
|
||||||
]
|
|
26
freedcs/telemetry/migrations/0003_auto_20200602_2131.py
Normal file
26
freedcs/telemetry/migrations/0003_auto_20200602_2131.py
Normal 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),
|
||||||
|
),
|
||||||
|
]
|
15
freedcs/telemetry/migrations/0004_auto_20200602_2132.py
Normal file
15
freedcs/telemetry/migrations/0004_auto_20200602_2132.py
Normal 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');"),
|
||||||
|
]
|
|
@ -6,7 +6,7 @@ from api.models import Device
|
||||||
|
|
||||||
class Telemetry(models.Model):
|
class Telemetry(models.Model):
|
||||||
device = models.ForeignKey(Device, on_delete=models.CASCADE)
|
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()
|
payload = JSONField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user