mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-11 01:27:29 +08:00
fix: 数据库迁移报错"''"
This commit is contained in:
parent
5d7c201018
commit
423ba84908
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user