mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
handle missing guid
This commit is contained in:
parent
6ca1eab9ff
commit
934b95831e
@ -76,6 +76,9 @@ func (s *Storage) CreateItems(items []Item) bool {
|
||||
if item.Date == nil {
|
||||
item.Date = item.DateUpdated
|
||||
}
|
||||
if item.GUID == "" {
|
||||
item.GUID = item.Link
|
||||
}
|
||||
_, err = tx.Exec(`
|
||||
insert into items (
|
||||
guid, feed_id, title, link, description,
|
||||
@ -84,7 +87,7 @@ func (s *Storage) CreateItems(items []Item) bool {
|
||||
status, image
|
||||
)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
on conflict (guid) do update set
|
||||
on conflict (feed_id, guid) do update set
|
||||
date_updated = ?, date_arrived = ?`,
|
||||
item.GUID, item.FeedId, html.UnescapeString(item.Title), item.Link, item.Description,
|
||||
item.Content, item.Author,
|
||||
|
@ -48,8 +48,8 @@ create table if not exists items (
|
||||
|
||||
create index if not exists idx_item_feed_id on items(feed_id);
|
||||
create index if not exists idx_item_status on items(status);
|
||||
create unique index if not exists idx_item_guid on items(guid);
|
||||
create index if not exists idx_item_search_rowid on items(search_rowid);
|
||||
create unique index if not exists idx_item_guid on items(feed_id, guid);
|
||||
|
||||
create table if not exists settings (
|
||||
key string primary key,
|
||||
|
Loading…
x
Reference in New Issue
Block a user