跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

提交记录
修改Core/Librarys/SQLite/SQLiteBuilder.cs+16 −1看文件
@@ -47,7 +47,8 @@ namespace Core.Librarys.SQLite
4747 INTEGER,
4848 datetime,
4949 nvarchar,
50删除: @int
50新增: @int,
51新增: bit
5152 }
5253
5354 /// <summary>
@@ -309,11 +310,18 @@ namespace Core.Librarys.SQLite
309310 private string GetCreateColumnSQL(string tableName, IModelProperties properties)
310311 {
311312 string typeDefault = !properties.PK ? properties.Type == DbType.@int ? "NULL DEFAULT 0" : "NULL DEFAULT ''" : "";
313新增:
314新增: if(properties.Type == DbType.bit)
315新增: {
316新增: typeDefault = " DEFAULT 0";
317新增: properties.Type = DbType.INTEGER;
318新增: }
312319
313320 if (properties.PK)
314321 {
315322 properties.Type = DbType.INTEGER;
316323 }
324新增:
317325 return $"ALTER table {tableName} ADD COLUMN [{properties.Name}] {properties.Type} {typeDefault}";
318326 }
319327 #endregion
@@ -332,6 +340,13 @@ namespace Core.Librarys.SQLite
332340 foreach (var p in model.Properties)
333341 {
334342 string typeDefault = p.Type == DbType.@int ? " NULL DEFAULT 0" : " NULL DEFAULT ''";
343新增:
344新增: if (p.Type == DbType.bit)
345新增: {
346新增: typeDefault = " DEFAULT 0";
347新增: p.Type = DbType.INTEGER;
348新增: }
349新增:
335350 if (p.PK)
336351 {
337352 typeDefault = "";