From 6c7672d3ec293f4a8b0136a096d2e2abd8d7ca01 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sun, 15 Nov 2020 11:53:22 +0100 Subject: [PATCH] Fix view to enable fts for posts without title --- databaseMigrations.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/databaseMigrations.go b/databaseMigrations.go index 87c6aed..47dac90 100644 --- a/databaseMigrations.go +++ b/databaseMigrations.go @@ -60,6 +60,17 @@ func migrateDb() error { return err }, }, + &migrator.Migration{ + Name: "00005", + Func: func(tx *sql.Tx) error { + _, err := tx.Exec(` + drop view view_posts_with_title; + create view view_posts_with_title as select id, path, title, content, published, updated, blog, section from (select p.rowid as id, p.path as path, pp.value as title, content, published, updated, blog, section from posts p left outer join (select * from post_parameters where parameter = 'title') pp on p.path = pp.path); + insert into posts_fts(posts_fts) values ('rebuild'); + `) + return err + }, + }, ), ) if err != nil {