Timescaledb Migrate

From UVOO Tech Wiki
Jump to navigation Jump to search

https://stackoverflow.com/questions/57910070/convert-hypertable-to-regular-postgres-table

CREATE TABLE pg_conditions (LIKE conditions INCLUDING ALL); -- duplicate table structure
INSERT INTO pg_conditions (SELECT * FROM conditions); -- copy all data
DROP TABLE conditions; -- drops hypertable
ALTER TABLE pg_conditions RENAME TO conditions; -- conditions is now a regular postgres table again