Revert isDBInitialized

This commit is contained in:
Deluan 2024-05-22 16:20:51 -04:00 committed by Joe Stump
parent 1247cb5174
commit a58f04b2ce
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -29,12 +29,18 @@ update media_file set updated_at = '0001-01-01';
return err
}
var (
once sync.Once
initialized bool
)
func isDBInitialized(tx *sql.Tx) bool {
return sync.OnceValue(func() bool {
once.Do(func() {
rows, err := tx.Query("select count(*) from property where id=?", consts.InitialSetupFlagKey)
checkErr(err)
return checkCount(rows) > 0
})()
initialized = checkCount(rows) > 0
})
return initialized
}
func checkCount(rows *sql.Rows) (count int) {