mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Sqlite dnable default
This commit is contained in:
@@ -21,6 +21,7 @@ namespace SqlSugar
|
|||||||
public DateTime? DbMinDate { get; set; } = Convert.ToDateTime("1900-01-01");
|
public DateTime? DbMinDate { get; set; } = Convert.ToDateTime("1900-01-01");
|
||||||
public bool IsNoReadXmlDescription { get; set; }
|
public bool IsNoReadXmlDescription { get; set; }
|
||||||
public bool SqlServerCodeFirstNvarchar { get; set; }
|
public bool SqlServerCodeFirstNvarchar { get; set; }
|
||||||
|
public bool SqliteCodeFirstEnableDefaultValue { get; set; }
|
||||||
public bool IsAutoUpdateQueryFilter { get; set; }
|
public bool IsAutoUpdateQueryFilter { get; set; }
|
||||||
public bool IsAutoDeleteQueryFilter { get; set; }
|
public bool IsAutoDeleteQueryFilter { get; set; }
|
||||||
public bool EnableModelFuncMappingColumn { get; set; }
|
public bool EnableModelFuncMappingColumn { get; set; }
|
||||||
|
@@ -514,6 +514,15 @@ AND sql LIKE '%" + tableName + "%'");
|
|||||||
string primaryKey = item.IsPrimarykey ? this.CreateTablePirmaryKey : null;
|
string primaryKey = item.IsPrimarykey ? this.CreateTablePirmaryKey : null;
|
||||||
string identity = item.IsIdentity ? this.CreateTableIdentity : null;
|
string identity = item.IsIdentity ? this.CreateTableIdentity : null;
|
||||||
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName), dataType, dataSize, nullType, primaryKey, identity);
|
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName), dataType, dataSize, nullType, primaryKey, identity);
|
||||||
|
if (item.DefaultValue.HasValue()&&this.Context.CurrentConnectionConfig?.MoreSettings?.SqliteCodeFirstEnableDefaultValue == true)
|
||||||
|
{
|
||||||
|
var value = item.DefaultValue;
|
||||||
|
if (!value.Contains("(")&&!value.EqualCase( "CURRENT_TIMESTAMP")&&!value.StartsWith("'"))
|
||||||
|
{
|
||||||
|
value = value.ToSqlValue();
|
||||||
|
}
|
||||||
|
addItem = $" {addItem} DEFAULT {value}";
|
||||||
|
}
|
||||||
columnArray.Add(addItem);
|
columnArray.Add(addItem);
|
||||||
}
|
}
|
||||||
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));
|
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<package >
|
<package >
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>SqlSugarCore</id>
|
<id>SqlSugarCore</id>
|
||||||
<version>5.1.4.108-preview20</version>
|
<version>5.1.4.108-preview22</version>
|
||||||
<authors>sunkaixuan</authors>
|
<authors>sunkaixuan</authors>
|
||||||
<owners>果糖大数据科技</owners>
|
<owners>果糖大数据科技</owners>
|
||||||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
|
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
|
||||||
|
@@ -485,7 +485,8 @@ namespace SqlSugar
|
|||||||
EnableModelFuncMappingColumn=it.MoreSettings.EnableModelFuncMappingColumn,
|
EnableModelFuncMappingColumn=it.MoreSettings.EnableModelFuncMappingColumn,
|
||||||
EnableOracleIdentity = it.MoreSettings.EnableOracleIdentity,
|
EnableOracleIdentity = it.MoreSettings.EnableOracleIdentity,
|
||||||
IsWithNoLockSubquery=it.MoreSettings.IsWithNoLockSubquery,
|
IsWithNoLockSubquery=it.MoreSettings.IsWithNoLockSubquery,
|
||||||
EnableCodeFirstUpdatePrecision=it.MoreSettings.EnableCodeFirstUpdatePrecision
|
EnableCodeFirstUpdatePrecision=it.MoreSettings.EnableCodeFirstUpdatePrecision,
|
||||||
|
SqliteCodeFirstEnableDefaultValue=it.MoreSettings.SqliteCodeFirstEnableDefaultValue
|
||||||
|
|
||||||
},
|
},
|
||||||
SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle
|
SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle
|
||||||
|
Reference in New Issue
Block a user