Skip to content

Instantly share code, notes, and snippets.

@moritz89
Created October 2, 2020 01:10
Show Gist options
  • Save moritz89/37bf5d4fb3820b8be6d7756237aa806d to your computer and use it in GitHub Desktop.
Save moritz89/37bf5d4fb3820b8be6d7756237aa806d to your computer and use it in GitHub Desktop.
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("farms", "0001_initial"),
]
operations = [
migrations.RunSQL("SELECT create_hypertable('farms_sensorreading', 'time');"),
migrations.RunSQL(
"ALTER TABLE farms_sensorreading SET (timescaledb.compress, timescaledb.compress_segmentby = 'sensor_id');"
),
migrations.RunSQL(
"SELECT add_compress_chunks_policy('farms_sensorreading', INTERVAL '7 days');"
),
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment