Support TimescaleDB database

This commit is contained in:
Anton Tananaev
2025-07-01 17:54:46 -07:00
parent c0f9d628b3
commit d062c8808f
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd"
logicalFilePath="changelog-6.8.0">
<changeSet author="author" id="changelog-6.8.0-timescale" runInTransaction="false">
<preConditions onFail="MARK_RAN">
<dbms type="postgresql"/>
<sqlCheck expectedResult="1">
SELECT 1 FROM pg_available_extensions WHERE name = 'timescaledb';
</sqlCheck>
</preConditions>
<sql splitStatements="true" endDelimiter=";">
CREATE EXTENSION IF NOT EXISTS timescaledb;
ALTER TABLE tc_positions DROP CONSTRAINT IF EXISTS tc_positions_pkey;
DROP INDEX IF EXISTS position_deviceid_fixtime;
SELECT create_hypertable(
'tc_positions',
'fixtime',
partitioning_column => 'deviceid',
number_partitions => 8,
migrate_data => TRUE
);
CREATE INDEX IF NOT EXISTS tc_positions_id_idx ON tc_positions(id);
</sql>
</changeSet>
</databaseChangeLog>

View File

@@ -32,5 +32,6 @@
<include file="changelog-6.3.xml" relativeToChangelogFile="true" />
<include file="changelog-6.6.xml" relativeToChangelogFile="true" />
<include file="changelog-6.7.0.xml" relativeToChangelogFile="true" />
<include file="changelog-6.8.0.xml" relativeToChangelogFile="true" />
</databaseChangeLog>