mirror of
https://github.com/getAlby/hub.git
synced 2026-08-20 13:28:40 +02:00
* fix: sqlite pragma statement not applying to all sqlite connections * fix: add migration to delete orphaned records * fix: migrate postgres transaction amount column to bigint * chore: simplify migration, update comment * fix: sqlite uri when running tests * fix: check that breaks tests * fix: db locking within transaction * fix: sqlite3 driver wrapper to execute PRAGMAs on each new connection (#1464) * fix: sqlite3 driver wrapper to execute PRAGMAs on each new connection * chore: add test to check temp_store value --------- Co-authored-by: Roland Bewick <roland.bewick@gmail.com> --------- Co-authored-by: Roman D <roman@dmitrienko.com>
33 lines
677 B
Go
33 lines
677 B
Go
package test
|
|
|
|
import (
|
|
"strconv"
|
|
"testing"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
"github.com/getAlby/hub/logger"
|
|
"github.com/getAlby/hub/tests/db"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestTempStorePragmaIsApplied(t *testing.T) {
|
|
logger.Init(strconv.Itoa(int(logrus.DebugLevel)))
|
|
gormDb, err := db.NewDB(t)
|
|
require.NoError(t, err)
|
|
defer db.CloseDB(gormDb)
|
|
|
|
if gormDb.Dialector.Name() != "sqlite" {
|
|
t.Skip("Skipping non-sqlite dialector")
|
|
}
|
|
|
|
var result string
|
|
err = gormDb.Raw("PRAGMA temp_store").Scan(&result).Error
|
|
require.NoError(t, err)
|
|
|
|
// PRAGMA temp_store = MEMORY
|
|
// MEMORY = 2
|
|
assert.Equal(t, "2", result)
|
|
}
|