Consistently use entryId name everywhere
This commit is contained in:
@@ -211,17 +211,17 @@ class Sense extends SQLWritable {
|
||||
}
|
||||
|
||||
class Entry extends SQLWritable {
|
||||
final int id;
|
||||
final int entryId;
|
||||
final List<KanjiElement> kanji;
|
||||
final List<ReadingElement> readings;
|
||||
final List<Sense> senses;
|
||||
|
||||
const Entry({
|
||||
required this.id,
|
||||
required this.entryId,
|
||||
required this.kanji,
|
||||
required this.readings,
|
||||
required this.senses,
|
||||
});
|
||||
|
||||
Map<String, Object?> get sqlValue => {'id': id};
|
||||
Map<String, Object?> get sqlValue => {'entryId': entryId};
|
||||
}
|
||||
|
||||
@@ -77,14 +77,14 @@ Future<void> seedJMDictData(List<Entry> entries, Database db) async {
|
||||
for (final k in e.kanji) {
|
||||
b.insert(
|
||||
JMdictTableNames.kanjiElement,
|
||||
k.sqlValue..addAll({'entryId': e.id}),
|
||||
k.sqlValue..addAll({'entryId': e.entryId}),
|
||||
);
|
||||
|
||||
for (final i in k.info) {
|
||||
b.insert(
|
||||
JMdictTableNames.kanjiInfo,
|
||||
{
|
||||
'entryId': e.id,
|
||||
'entryId': e.entryId,
|
||||
'reading': k.reading,
|
||||
'info': i,
|
||||
},
|
||||
@@ -95,14 +95,14 @@ Future<void> seedJMDictData(List<Entry> entries, Database db) async {
|
||||
for (final r in e.readings) {
|
||||
b.insert(
|
||||
JMdictTableNames.readingElement,
|
||||
r.sqlValue..addAll({'entryId': e.id}),
|
||||
r.sqlValue..addAll({'entryId': e.entryId}),
|
||||
);
|
||||
|
||||
for (final i in r.info) {
|
||||
b.insert(
|
||||
JMdictTableNames.readingInfo,
|
||||
{
|
||||
'entryId': e.id,
|
||||
'entryId': e.entryId,
|
||||
'reading': r.reading,
|
||||
'info': i,
|
||||
},
|
||||
@@ -112,7 +112,7 @@ Future<void> seedJMDictData(List<Entry> entries, Database db) async {
|
||||
b.insert(
|
||||
JMdictTableNames.readingRestriction,
|
||||
{
|
||||
'entryId': e.id,
|
||||
'entryId': e.entryId,
|
||||
'reading': r.reading,
|
||||
'restriction': res,
|
||||
},
|
||||
@@ -128,7 +128,7 @@ Future<void> seedJMDictData(List<Entry> entries, Database db) async {
|
||||
|
||||
for (final e in entries) {
|
||||
for (final s in e.senses) {
|
||||
b.insert(JMdictTableNames.sense, s.sqlValue..addAll({'entryId': e.id}));
|
||||
b.insert(JMdictTableNames.sense, s.sqlValue..addAll({'entryId': e.entryId}));
|
||||
for (final d in s.dialects) {
|
||||
b.insert(
|
||||
JMdictTableNames.senseDialect,
|
||||
@@ -150,13 +150,13 @@ Future<void> seedJMDictData(List<Entry> entries, Database db) async {
|
||||
for (final rk in s.restrictedToKanji) {
|
||||
b.insert(
|
||||
JMdictTableNames.senseRestrictedToKanji,
|
||||
{'entryId': e.id, 'senseId': s.id, 'kanji': rk},
|
||||
{'entryId': e.entryId, 'senseId': s.id, 'kanji': rk},
|
||||
);
|
||||
}
|
||||
for (final rr in s.restrictedToReading) {
|
||||
b.insert(
|
||||
JMdictTableNames.senseRestrictedToReading,
|
||||
{'entryId': e.id, 'senseId': s.id, 'reading': rr},
|
||||
{'entryId': e.entryId, 'senseId': s.id, 'reading': rr},
|
||||
);
|
||||
}
|
||||
for (final ls in s.languageSource) {
|
||||
@@ -215,7 +215,7 @@ Future<void> seedJMDictData(List<Entry> entries, Database db) async {
|
||||
JMdictTableNames.senseSeeAlso,
|
||||
{
|
||||
'senseId': s.id,
|
||||
'xrefEntryId': resolvedEntry.entry.id,
|
||||
'xrefEntryId': resolvedEntry.entry.entryId,
|
||||
'seeAlsoKanji': xref.kanjiRef,
|
||||
'seeAlsoReading': xref.readingRef,
|
||||
'seeAlsoSense': xref.senseOrderNum,
|
||||
@@ -233,7 +233,7 @@ Future<void> seedJMDictData(List<Entry> entries, Database db) async {
|
||||
|
||||
b.insert(JMdictTableNames.senseAntonyms, {
|
||||
'senseId': s.id,
|
||||
'xrefEntryId': resolvedEntry.entry.id,
|
||||
'xrefEntryId': resolvedEntry.entry.entryId,
|
||||
'antonymKanji': ant.kanjiRef,
|
||||
'antonymReading': ant.readingRef,
|
||||
'antonymSense': ant.senseOrderNum,
|
||||
|
||||
@@ -190,7 +190,7 @@ List<Entry> parseJMDictData(XmlElement root) {
|
||||
|
||||
entries.add(
|
||||
Entry(
|
||||
id: entryId,
|
||||
entryId: entryId,
|
||||
kanji: kanjiEls,
|
||||
readings: readingEls,
|
||||
senses: senses,
|
||||
|
||||
@@ -33,13 +33,13 @@ CREATE TABLE "JMdict_InfoReading" (
|
||||
-- not implement a check for it.
|
||||
|
||||
CREATE TABLE "JMdict_Entry" (
|
||||
"id" INTEGER PRIMARY KEY
|
||||
"entryId" INTEGER PRIMARY KEY
|
||||
);
|
||||
|
||||
-- KanjiElement
|
||||
|
||||
CREATE TABLE "JMdict_KanjiElement" (
|
||||
"entryId" INTEGER NOT NULL REFERENCES "JMdict_Entry"("id"),
|
||||
"entryId" INTEGER NOT NULL REFERENCES "JMdict_Entry"("entryId"),
|
||||
"orderNum" INTEGER NOT NULL,
|
||||
"reading" TEXT NOT NULL,
|
||||
"news" INTEGER CHECK ("news" BETWEEN 1 AND 2),
|
||||
@@ -64,7 +64,7 @@ CREATE TABLE "JMdict_KanjiElementInfo" (
|
||||
-- ReadingElement
|
||||
|
||||
CREATE TABLE "JMdict_ReadingElement" (
|
||||
"entryId" INTEGER NOT NULL REFERENCES "JMdict_Entry"("id"),
|
||||
"entryId" INTEGER NOT NULL REFERENCES "JMdict_Entry"("entryId"),
|
||||
"orderNum" INTEGER NOT NULL,
|
||||
"reading" TEXT NOT NULL,
|
||||
"readingDoesNotMatchKanji" BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
@@ -100,7 +100,7 @@ CREATE TABLE "JMdict_ReadingElementInfo" (
|
||||
|
||||
CREATE TABLE "JMdict_Sense" (
|
||||
"id" INTEGER PRIMARY KEY,
|
||||
"entryId" INTEGER NOT NULL REFERENCES "JMdict_Entry"("id"),
|
||||
"entryId" INTEGER NOT NULL REFERENCES "JMdict_Entry"("entryId"),
|
||||
"orderNum" INTEGER NOT NULL,
|
||||
UNIQUE("entryId", "orderNum")
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@ CREATE TABLE "JMdict_JLPTTag" (
|
||||
"entryId" INTEGER NOT NULL,
|
||||
"jlptLevel" CHAR(2) NOT NULL CHECK ("jlptLevel" in ('N5', 'N4', 'N3', 'N2', 'N1')),
|
||||
FOREIGN KEY ("entryId")
|
||||
REFERENCES "JMdict_Entry"("id"),
|
||||
REFERENCES "JMdict_Entry"("entryId"),
|
||||
PRIMARY KEY ("entryId", "jlptLevel")
|
||||
) WITHOUT ROWID;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user