in src/middleware/db.go [114:131]
func (s SQLStorage) SchemaExists() (bool, error) {
s.log("Checking schema exists")
var result string
err := s.db.QueryRow(`SELECT
table_schema || '.' || table_name
FROM
information_schema.tables
WHERE
table_type = 'BASE TABLE'
AND
table_schema NOT IN ('pg_catalog', 'information_schema');`).Scan(&result)
if err != nil && err != sql.ErrNoRows {
return false, fmt.Errorf("schema check failed: %s", err)
}
s.log("Schema check complete")
s.log(fmt.Sprintf("Schema err: %s", err))
return len(result) > 0, nil
}