mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-23 22:40:24 +02:00
fixed daos.SaveView test
This commit is contained in:
1 parent
5fd7f61656
commit
b184ef6c3a
3 files changed
+13
-4
No files matched your search
+10
-1
@@ -39,8 +39,17 @@ func (dao *Dao) GetTableInfo(tableName string) ([]*models.TableInfoRow, error) {
|
||||
err := dao.DB().NewQuery("SELECT * FROM PRAGMA_TABLE_INFO({:tableName})").
|
||||
Bind(dbx.Params{"tableName": tableName}).
|
||||
All(&info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return info, err
|
||||
// mattn/go-sqlite3 doesn't throw an error on invalid or missing table
|
||||
// so we additionally have to check whether the loaded info result is nonempty
|
||||
if len(info) == 0 {
|
||||
return nil, fmt.Errorf("empty table info probably due to invalid or missing table %s", tableName)
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
// DeleteTable drops the specified table.
|
||||
|
||||
Reference in new issue
Block a user