diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-08-12 09:28:42 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2025-10-27 10:29:19 +0100 |
| commit | 83972171d712c60ddfaeb4a68ef1cfd8c314fc10 (patch) | |
| tree | 852b8d93699abacf07de464b7b1c8c42ad4dd344 /lib | |
| parent | 76e4c5bd5016347dca083b6932e6adf03f398cad (diff) | |
| download | mihi-83972171d712c60ddfaeb4a68ef1cfd8c314fc10.tar.gz mihi-83972171d712c60ddfaeb4a68ef1cfd8c314fc10.zip | |
Ensure a non-NULL value for words.succeeded
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mihi/src/lib.rs | 7 | ||||
| -rw-r--r-- | lib/mihi/src/migrate.rs | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/mihi/src/lib.rs b/lib/mihi/src/lib.rs index 12953c3..41a9953 100644 --- a/lib/mihi/src/lib.rs +++ b/lib/mihi/src/lib.rs @@ -397,9 +397,9 @@ pub fn create_word(word: Word) -> Result<(), String> { match conn.execute( "INSERT INTO words (enunciated, particle, language_id, declension_id, \ conjugation_id, kind, category, regular, locative, \ - gender, suffix, flags, translation, weight, \ + gender, suffix, flags, translation, weight, succeeded, \ updated_at, created_at) \ - VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, \ + VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, \ datetime('now'), datetime('now'))", params![ word.enunciated, @@ -415,7 +415,8 @@ pub fn create_word(word: Word) -> Result<(), String> { word.suffix, serde_json::to_string(&word.flags).unwrap(), serde_json::to_string(&word.translation).unwrap(), - word.weight + word.weight, + 0 ], ) { Ok(_) => Ok(()), diff --git a/lib/mihi/src/migrate.rs b/lib/mihi/src/migrate.rs index f8fcc8d..58a1681 100644 --- a/lib/mihi/src/migrate.rs +++ b/lib/mihi/src/migrate.rs @@ -26,8 +26,8 @@ CREATE TABLE IF NOT EXISTS "words" ( "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "suffix" varchar, - "language_id" integer, - "succeeded" integer, + "language_id" integer NOT NULL, + "succeeded" integer DEFAULT 0 NOT NULL, "steps" integer DEFAULT 0 NOT NULL, "translation" jsonb DEFAULT '{}', "pending" boolean DEFAULT 0, |
