You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
800 B

let p = console.log
2 years ago
import Dexie from 'dexie'
import 'dexie-export-import'
import { nanoid } from 'nanoid'
let db = new Dexie 'fuzzyhome'
db.version(1).stores({
links: "++id,name,link"
})
db.version(2).stores({
links: "++id,name,url,frequency,img"
}).upgrade! do |trans|
p "upgrading to fuzzyhome db version 2"
2 years ago
trans.links.toCollection!.modify! do |link|
let id = nanoid!
let name = link.name
let url = link.link
let frequency = link.frequency
let img = link.img
this.value = { id, name, url, frequency, img }
import { parse_url } from './utils'
db.version(3).stores({
links: "++id,name,url,frequency,img"
}).upgrade! do |trans|
p "upgrading to fuzzyhome db version 3"
trans.links.toCollection!.modify! do |link|
try
link.url = parse_url(link.url).href
2 years ago
export default db