From 423ba849087c6e2bce1681c9ef421669e714a1a2 Mon Sep 17 00:00:00 2001 From: snowy Date: Tue, 26 Mar 2024 22:41:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E6=8A=A5=E9=94=99"''"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/utils/data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/liteyuki/utils/data.py b/liteyuki/utils/data.py index c22361d0..0c2d5556 100644 --- a/liteyuki/utils/data.py +++ b/liteyuki/utils/data.py @@ -238,7 +238,7 @@ class Database: # 检测缺失字段,由于SQLite是动态类型,所以不需要检测类型 for n_field, n_type in new_structure.items(): if n_field not in existing_structure.keys() and n_field.lower() not in ["id", "table_name"]: - default_value = self.DEFAULT_MAPPING.get(n_type, "''") + default_value = self.DEFAULT_MAPPING.get(n_type, 'NULL') self.cursor.execute( f"ALTER TABLE '{model.TABLE_NAME}' ADD COLUMN {n_field} {n_type} DEFAULT {self.DEFAULT_MAPPING.get(n_type, default_value)}" ) @@ -320,7 +320,7 @@ class Database: "TEXT" : "''", "INTEGER": 0, "REAL" : 0.0, - "BLOB" : b"", + "BLOB" : None, "NULL" : None }