Schema changes
This section describes the schema changes happening between different Data Orchestrator Versions.
They are divided between Data Orchestrator Keyspace (changes that affect the Data Orchestrator Keyspace), and Realm Keyspaces (changes that affect all realm keyspaces).
Every change is followed by the CQL statement that produces the change.
From v0.10 to v0.11
Data Orchestrator Keyspace v0.11 Changes
- Remove
astarte_schematable
DROP TABLE astarte_schema;
- Remove
replication_factorcolumn from therealmstable
ALTER TABLE realms
DROP replication_factor;
Realm Keyspaces v0.11 Changes
- Add
grouped_devicestable
CREATE TABLE <realm_name>.grouped_devices (
group_name varchar,
insertion_uuid timeuuid,
device_id uuid,
PRIMARY KEY ((group_name), insertion_uuid, device_id)
);
- Add
groups,exchanged_bytes_by_interfaceandexchanged_msgs_by_interfacecolumns to thedevicestable
ALTER TABLE <realm_name>.devices
ADD (groups map<varchar, timeuuid>,
exchanged_bytes_by_interface map<frozen<tuple<ascii, int>>, bigint>,
exchanged_msgs_by_interface map<frozen<tuple<ascii, int>>, bigint>);
- Add
database_retention_ttlanddatabase_retention_policycolumns to theendpointstable
ALTER TABLE <realm_name>.endpoints
ADD (
database_retention_ttl int,
database_retention_policy int
);
From v0.11 to v1.0.0-beta.1
Realm Keyspace v1.0.0-beta.1 Changes
-
The
connectedfield of thedevicestable is now saved with a TTL, so it automatically expires if it doesn't gets refreshed by the heartbeat sent by the broker. This behaviour was added to avoid stale connected devices if they disconnect while the broker is down. -
Add
metadatacolumn to thedevicestable
ALTER TABLE devices
ADD (
metadata map<varchar, varchar>
);
From v1.0-beta.1 to v1.0.0
Realm Keyspace v1.0.0 Changes
- Rename the
metadatatoattributesin thedevicestable
Warning: migrating data from the metadata column to the attributes one is possible but is out
of scope of this guide since this change happened between development releases. The procedure below
just creates the new column and then deletes the old one without migrating data. You're free to
implement a migration procedure between the two steps.
ALTER TABLE devices
ADD (
attributes map<varchar, varchar>
);
ALTER TABLE devices
DROP metadata;