feat: TimescaleDB hypertable migration and README
Add hypertable migration that only runs on PostgreSQL (no-op for SQLite dev/tests). Update README with architecture, quick start, and client sync instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
33
src/openclaw/migrations/0002_add_hypertables.py
Normal file
33
src/openclaw/migrations/0002_add_hypertables.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from django.db import migrations, connection
|
||||
|
||||
CREATE_HYPERTABLES = """
|
||||
SELECT create_hypertable(
|
||||
'sessions',
|
||||
'start_time',
|
||||
if_not_exists => TRUE
|
||||
);
|
||||
|
||||
SELECT create_hypertable(
|
||||
'messages',
|
||||
'timestamp',
|
||||
if_not_exists => TRUE
|
||||
);
|
||||
"""
|
||||
|
||||
|
||||
def create_hypertables(apps, schema_editor):
|
||||
if connection.vendor != "postgresql":
|
||||
return
|
||||
with schema_editor.connection.cursor() as cursor:
|
||||
cursor.execute(CREATE_HYPERTABLES)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("openclaw", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_hypertables, migrations.RunPython.noop),
|
||||
]
|
||||
Reference in New Issue
Block a user