fix(filters): explicitly search in json when using postgres
Resolves https://github.com/go-vikunja/vikunja/issues/330 Resolves https://community.vikunja.io/t/add-task-to-filter-view-cron-error-fetching-filters-pq-operator-does-not-exist-json-unknown/2831 (cherry picked from commit ca967782e855452f59fecebdd5dc42d46c3ca674)
This commit is contained in:
parent
60fa211334
commit
7a839925ea
@ -360,8 +360,13 @@ func RegisterAddTaskToFilterViewCron() {
|
|||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
// Get all filters with a date clause and a manual kanban view
|
// Get all filters with a date clause and a manual kanban view
|
||||||
|
where := "filters LIKE '%_date%'"
|
||||||
|
if db.GetDialect() == builder.POSTGRES {
|
||||||
|
where = "filters::jsonb ?| array['due_date', 'start_date', 'end_date']"
|
||||||
|
}
|
||||||
|
|
||||||
filters := map[int64]*SavedFilter{}
|
filters := map[int64]*SavedFilter{}
|
||||||
err := s.Where("filters LIKE '%_date%'").Find(&filters)
|
err := s.Where(where).Find(&filters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("%sError fetching filters: %s", logPrefix, err)
|
log.Errorf("%sError fetching filters: %s", logPrefix, err)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user