20 lines
837 B
SQL
20 lines
837 B
SQL
-- Triggered on first start only (when $PGDATA is empty).
|
|
-- Enables TimescaleDB extension in the datahub database.
|
|
--
|
|
-- Three-layer defense for extension activation:
|
|
-- 1. Upstream timescale image: /docker-entrypoint-initdb.d/000_install_timescaledb.sh
|
|
-- already runs CREATE EXTENSION in $POSTGRES_DB; this file is defensive backup.
|
|
-- 2. This script: explicit \connect datahub then CREATE EXTENSION.
|
|
-- 3. backend/migrations/2026_05_07_100000_enable_timescaledb_extension.php
|
|
-- runs CREATE EXTENSION IF NOT EXISTS on application boot.
|
|
--
|
|
-- All three layers are idempotent (IF NOT EXISTS), zero runtime cost.
|
|
|
|
\connect datahub
|
|
|
|
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
|
|
|
-- Future extensions can be added here, e.g.:
|
|
-- CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
|
|
-- CREATE EXTENSION IF NOT EXISTS pg_trgm;
|