From 6b39742a353a55b70e4fdc72538d629587734ffc Mon Sep 17 00:00:00 2001 From: Radhi Fadlillah Date: Thu, 22 Aug 2019 14:27:38 +0700 Subject: [PATCH] Make SQLite database compatible with old version --- internal/database/sqlite.go | 3 +++ internal/model/model.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/database/sqlite.go b/internal/database/sqlite.go index bb7c13e..78fcad8 100644 --- a/internal/database/sqlite.go +++ b/internal/database/sqlite.go @@ -73,6 +73,9 @@ func OpenSQLiteDatabase(databasePath string) (sqliteDB *SQLiteDatabase, err erro tx.MustExec(`CREATE VIRTUAL TABLE IF NOT EXISTS bookmark_content USING fts4(title, content, html)`) + // Alter table if needed + tx.Exec(`ALTER TABLE account ADD COLUMN owner INTEGER NOT NULL DEFAULT 0`) + err = tx.Commit() checkError(err) diff --git a/internal/model/model.go b/internal/model/model.go index 889e397..96f214f 100644 --- a/internal/model/model.go +++ b/internal/model/model.go @@ -19,9 +19,9 @@ type Bookmark struct { Modified string `db:"modified" json:"modified"` Content string `db:"content" json:"-"` HTML string `db:"html" json:"html,omitempty"` + ImageURL string `db:"image_url" json:"imageURL"` HasContent bool `db:"has_content" json:"hasContent"` HasArchive bool `json:"hasArchive"` - ImageURL string `json:"imageURL"` Tags []Tag `json:"tags"` CreateArchive bool `json:"createArchive"` }