@ -52,10 +52,12 @@ initDatabase config = do
@@ -52,10 +52,12 @@ initDatabase config = do
infoM"DB"$"Initializing DB"
conn<-connectSqlite3(T.unpack$dbPathconfig)
makeSchemaconn
makeIndexconn
infoM"DB"$"Schema updated"
returnconn
where
makeSchemaconn=runRawconn"CREATE TABLE IF NOT EXISTS bars (id SERIAL PRIMARY KEY, ticker TEXT, timestamp BIGINT, timeframe INTEGER, open NUMERIC(20, 10), high NUMERIC(20, 10), low NUMERIC(20, 10), close NUMERIC(20,10), volume BIGINT);"
makeIndexconn=runRawconn"CREATE INDEX IF NOT EXISTS idx_bars ON bars (ticker, timeframe);"