diff --git a/freedcs/api/migrations/0003_auto_20200602_2128.py b/freedcs/api/migrations/0003_auto_20200602_2128.py new file mode 100644 index 0000000..b01d214 --- /dev/null +++ b/freedcs/api/migrations/0003_auto_20200602_2128.py @@ -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]), + ), + ] diff --git a/freedcs/telemetry/migrations/0003_auto_20200601_1710.py b/freedcs/telemetry/migrations/0003_auto_20200601_1710.py deleted file mode 100644 index a82d865..0000000 --- a/freedcs/telemetry/migrations/0003_auto_20200601_1710.py +++ /dev/null @@ -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 = [ - ] diff --git a/freedcs/telemetry/migrations/0003_auto_20200602_2131.py b/freedcs/telemetry/migrations/0003_auto_20200602_2131.py new file mode 100644 index 0000000..b48039b --- /dev/null +++ b/freedcs/telemetry/migrations/0003_auto_20200602_2131.py @@ -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), + ), + ] diff --git a/freedcs/telemetry/migrations/0004_auto_20200602_2132.py b/freedcs/telemetry/migrations/0004_auto_20200602_2132.py new file mode 100644 index 0000000..94f40bd --- /dev/null +++ b/freedcs/telemetry/migrations/0004_auto_20200602_2132.py @@ -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');"), + ] diff --git a/freedcs/telemetry/models.py b/freedcs/telemetry/models.py index 6a6fd91..ce95be9 100644 --- a/freedcs/telemetry/models.py +++ b/freedcs/telemetry/models.py @@ -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: