[Files Refactor] Rollback platform-agnostic paths (#2852)

* Rollback platform agnostic path storage
* Add release note for database change
This commit is contained in:
WithoutPants
2022-08-26 14:56:46 +10:00
parent 0c7b5cf6a1
commit 7b439556c0
13 changed files with 149 additions and 206 deletions

View File

@@ -584,13 +584,11 @@ func (qb *FileStore) FindByPath(ctx context.Context, p string) (file.File, error
basename = strings.ReplaceAll(basename, "*", "%")
dirName = strings.ReplaceAll(dirName, "*", "%")
dir, _ := path(dirName).Value()
table := qb.table()
folderTable := folderTableMgr.table
q := qb.selectDataset().Prepared(true).Where(
folderTable.Col("path").Like(dir),
folderTable.Col("path").Like(dirName),
table.Col("basename").Like(basename),
)
@@ -607,10 +605,9 @@ func (qb *FileStore) allInPaths(q *goqu.SelectDataset, p []string) *goqu.SelectD
var conds []exp.Expression
for _, pp := range p {
dir, _ := path(pp).Value()
dirWildcard, _ := path(pp + string(filepath.Separator) + "%").Value()
ppWildcard := pp + string(filepath.Separator) + "%"
conds = append(conds, folderTable.Col("path").Eq(dir), folderTable.Col("path").Like(dirWildcard))
conds = append(conds, folderTable.Col("path").Eq(pp), folderTable.Col("path").Like(ppWildcard))
}
return q.Where(