about summary refs log tree commit diff
path: root/corp/russian/data-import/src/db_setup.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-18T12·48+0300
committertazjin <tazjin@tvl.su>2023-01-18T15·44+0000
commitdc55ea320101282f200c0117ebdf7033f3bae927 (patch)
treedfa3b408d5929185ba13af5456eb4df1e8dc7154 /corp/russian/data-import/src/db_setup.rs
parent3f0b1d8e0b518c6f4684f65ae421f71864176d99 (diff)
feat(corp/data-import): parse and import link types r/5690
Change-Id: Iae01d1dc6894117dc693b4690d8bc79861212ae6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7863
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'corp/russian/data-import/src/db_setup.rs')
-rw-r--r--corp/russian/data-import/src/db_setup.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/corp/russian/data-import/src/db_setup.rs b/corp/russian/data-import/src/db_setup.rs
index 1a9e2dd879..d85374dfa8 100644
--- a/corp/russian/data-import/src/db_setup.rs
+++ b/corp/russian/data-import/src/db_setup.rs
@@ -50,6 +50,12 @@ CREATE TABLE word_grammemes (
     FOREIGN KEY(word) REFERENCES words(ROWID)
 ) STRICT;
 
+-- table for link types
+CREATE TABLE link_types (
+  id INTEGER PRIMARY KEY,
+  name TEXT
+) STRICT;
+
 "#,
     )
     .ensure("setting up initial table schema failed");
@@ -76,6 +82,16 @@ pub fn insert_oc_element(conn: &Connection, elem: OcElement) {
         }
 
         OcElement::Lemma(lemma) => insert_lemma(conn, lemma),
+
+        OcElement::LinkType(lt) => {
+            conn.execute(
+                "INSERT INTO link_types (id, name) VALUES (?1, ?2)",
+                (&lt.id, &lt.name),
+            )
+            .ensure("failed to insert link type");
+
+            info!("inserted link type {}", lt.name);
+        }
     }
 }