mirror of
https://github.com/traccar/traccar.git
synced 2026-04-24 00:57:37 -04:00
Support TimescaleDB database
This commit is contained in:
36
schema/changelog-6.8.0.xml
Normal file
36
schema/changelog-6.8.0.xml
Normal 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>
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user