aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/database.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-12-18 22:24:34 -0800
committerAlex Yatskov <alex@foosoft.net>2016-12-18 22:24:34 -0800
commit238c9e340e5f42f12e6f7f16b1da7b87652aa821 (patch)
treea1dc0e31698e59c664b1be15e9a66430888458b0 /ext/bg/js/database.js
parent862b49dfd9e243702ca18cd02c5727cd8f8d392e (diff)
WIP
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r--ext/bg/js/database.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 73acd1ae..7ad7d410 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -30,10 +30,10 @@ class Database {
this.db = new Dexie('dict');
this.db.version(1).stores({
- terms: '++id, dictionary, expression, reading',
- kanji: '++, dictionary, character',
- tagMeta: '++, dictionary',
- dictionaries: '++, title, version',
+ terms: '++id,dictionary,expression,reading',
+ kanji: '++,dictionary,character',
+ tagMeta: '++,dictionary',
+ dictionaries: '++,title,version',
});
return this.db.open();
@@ -48,7 +48,7 @@ class Database {
return this.db.delete().then(() => {
this.db = null;
this.tagMetaCache = {};
- this.prepare();
+ return this.prepare();
});
}
@@ -64,6 +64,7 @@ class Database {
expression: row.expression,
reading: row.reading,
tags: splitField(row.tags),
+ rules: splitField(row.rules),
glossary: row.glossary,
score: row.score,
dictionary: row.dictionary,
@@ -123,11 +124,7 @@ class Database {
const tagMeta = {};
promises.push(
this.db.tagMeta.where('dictionary').equals(dictionary).each(row => {
- tagMeta[row.name] = {
- category: row.category,
- notes: row.notes,
- order: row.order
- };
+ tagMeta[row.name] = {category: row.category, notes: row.notes, order: row.order};
}).then(() => {
this.tagMetaCache[dictionary] = tagMeta;
})