This commit is contained in:
parent
fe1d1b5635
commit
7d04a97109
1 changed files with 6 additions and 5 deletions
11
main.go
11
main.go
|
@ -48,16 +48,17 @@ func main() {
|
||||||
|
|
||||||
// Connect to PostgreSQL
|
// Connect to PostgreSQL
|
||||||
pgConnStr := os.Getenv("PG_DB")
|
pgConnStr := os.Getenv("PG_DB")
|
||||||
db, err := sql.Open("postgres", pgConnStr)
|
var err error
|
||||||
|
db, err = sql.Open("postgres", pgConnStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
// Enable TimescaleDB
|
// Enable TimescaleDB
|
||||||
_, err = db.Exec(`
|
// _, err = db.Exec(`
|
||||||
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
// CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||||
`)
|
// `)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error creating TimescaleDB extension:", err)
|
log.Fatal("Error creating TimescaleDB extension:", err)
|
||||||
}
|
}
|
||||||
|
@ -88,7 +89,7 @@ func main() {
|
||||||
returning_l2 INT,
|
returning_l2 INT,
|
||||||
returning_l3 INT
|
returning_l3 INT
|
||||||
);
|
);
|
||||||
SELECT create_hypertable('p1', 'timestamp', if_not_exists => TRUE);
|
-- SELECT create_hypertable('p1', 'timestamp', if_not_exists => TRUE);
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error creating table:", err)
|
log.Fatal("Error creating table:", err)
|
||||||
|
|
Loading…
Reference in a new issue