mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
@@ -302,9 +302,9 @@ namespace SqlSugar
|
|||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public virtual bool CreateIndex(string tableName, string[] columnNames)
|
public virtual bool CreateIndex(string tableName, string[] columnNames, bool isUnique=false)
|
||||||
{
|
{
|
||||||
string sql = string.Format(CreateIndexSql,tableName,string.Join(",",columnNames), string.Join("_", columnNames));
|
string sql = string.Format(CreateIndexSql,tableName,string.Join(",",columnNames), string.Join("_", columnNames), isUnique ? "UNIQUE" : "");
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -193,6 +193,7 @@ namespace SqlSugar
|
|||||||
column.NoSerialize = sugarColumn.NoSerialize;
|
column.NoSerialize = sugarColumn.NoSerialize;
|
||||||
column.DefaultValue = sugarColumn.DefaultValue;
|
column.DefaultValue = sugarColumn.DefaultValue;
|
||||||
column.IndexGroupNameList = sugarColumn.IndexGroupNameList;
|
column.IndexGroupNameList = sugarColumn.IndexGroupNameList;
|
||||||
|
column.UIndexGroupNameList = sugarColumn.UIndexGroupNameList;
|
||||||
column.IsOnlyIgnoreUpdate = sugarColumn.IsOnlyIgnoreUpdate;
|
column.IsOnlyIgnoreUpdate = sugarColumn.IsOnlyIgnoreUpdate;
|
||||||
column.IsArray = sugarColumn.IsArray;
|
column.IsArray = sugarColumn.IsArray;
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@ namespace SqlSugar
|
|||||||
public bool IsJson { get; set; }
|
public bool IsJson { get; set; }
|
||||||
public bool NoSerialize { get; set; }
|
public bool NoSerialize { get; set; }
|
||||||
public string[] IndexGroupNameList { get; set; }
|
public string[] IndexGroupNameList { get; set; }
|
||||||
|
public string[] UIndexGroupNameList { get; set; }
|
||||||
public bool IsArray { get; set; }
|
public bool IsArray { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -171,6 +171,8 @@ namespace SqlSugar
|
|||||||
set { _IndexGroupNameList = value; }
|
set { _IndexGroupNameList = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string[] UIndexGroupNameList { get; set; }
|
||||||
|
|
||||||
private bool _IsArray;
|
private bool _IsArray;
|
||||||
public bool IsArray
|
public bool IsArray
|
||||||
{
|
{
|
||||||
|
@@ -28,7 +28,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
#region DDL
|
#region DDL
|
||||||
bool AddDefaultValue(string tableName,string columnName,string defaultValue);
|
bool AddDefaultValue(string tableName,string columnName,string defaultValue);
|
||||||
bool CreateIndex(string tableName, string [] columnNames);
|
bool CreateIndex(string tableName, string [] columnNames, bool isUnique=false);
|
||||||
bool DropTable(string tableName);
|
bool DropTable(string tableName);
|
||||||
bool TruncateTable(string tableName);
|
bool TruncateTable(string tableName);
|
||||||
bool TruncateTable<T>();
|
bool TruncateTable<T>();
|
||||||
|
@@ -62,7 +62,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0}({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0}({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
@@ -271,9 +271,9 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return base.AddColumn(tableName, columnInfo);
|
return base.AddColumn(tableName, columnInfo);
|
||||||
}
|
}
|
||||||
public override bool CreateIndex(string tableName, string[] columnNames)
|
public override bool CreateIndex(string tableName, string[] columnNames, bool isUnique = false)
|
||||||
{
|
{
|
||||||
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it => (it + "abc").Substring(0, 3))));
|
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it => (it + "abc").Substring(0, 3))), isUnique ? "UNIQUE" : "");
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -250,7 +250,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0} ({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0} ({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0}({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0}({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
@@ -271,9 +271,9 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return base.AddColumn(tableName,columnInfo);
|
return base.AddColumn(tableName,columnInfo);
|
||||||
}
|
}
|
||||||
public override bool CreateIndex(string tableName, string[] columnNames)
|
public override bool CreateIndex(string tableName, string[] columnNames, bool isUnique=false)
|
||||||
{
|
{
|
||||||
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it=>(it+"abc").Substring(0,3))));
|
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it=>(it+"abc").Substring(0,3))), isUnique ? "UNIQUE" : "");
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -178,7 +178,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0} ({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0} ({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
|
@@ -249,7 +249,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE NONCLUSTERED INDEX Index_{0}_{2} ON {0}({1})";
|
return "CREATE {3} NONCLUSTERED INDEX Index_{0}_{2} ON {0}({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
|
@@ -302,9 +302,9 @@ namespace SqlSugar
|
|||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public virtual bool CreateIndex(string tableName, string[] columnNames)
|
public virtual bool CreateIndex(string tableName, string[] columnNames, bool isUnique = false)
|
||||||
{
|
{
|
||||||
string sql = string.Format(CreateIndexSql,tableName,string.Join(",",columnNames), string.Join("_", columnNames));
|
string sql = string.Format(CreateIndexSql,tableName,string.Join(",",columnNames), string.Join("_", columnNames), isUnique ? "UNIQUE" : "");
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -193,6 +193,7 @@ namespace SqlSugar
|
|||||||
column.NoSerialize = sugarColumn.NoSerialize;
|
column.NoSerialize = sugarColumn.NoSerialize;
|
||||||
column.DefaultValue = sugarColumn.DefaultValue;
|
column.DefaultValue = sugarColumn.DefaultValue;
|
||||||
column.IndexGroupNameList = sugarColumn.IndexGroupNameList;
|
column.IndexGroupNameList = sugarColumn.IndexGroupNameList;
|
||||||
|
column.UIndexGroupNameList = sugarColumn.UIndexGroupNameList;
|
||||||
column.IsOnlyIgnoreUpdate = sugarColumn.IsOnlyIgnoreUpdate;
|
column.IsOnlyIgnoreUpdate = sugarColumn.IsOnlyIgnoreUpdate;
|
||||||
column.IsArray = sugarColumn.IsArray;
|
column.IsArray = sugarColumn.IsArray;
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@ namespace SqlSugar
|
|||||||
public bool IsJson { get; set; }
|
public bool IsJson { get; set; }
|
||||||
public bool NoSerialize { get; set; }
|
public bool NoSerialize { get; set; }
|
||||||
public string[] IndexGroupNameList { get; set; }
|
public string[] IndexGroupNameList { get; set; }
|
||||||
|
public string[] UIndexGroupNameList { get; set; }
|
||||||
public bool IsArray { get; set; }
|
public bool IsArray { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -171,6 +171,8 @@ namespace SqlSugar
|
|||||||
set { _IndexGroupNameList = value; }
|
set { _IndexGroupNameList = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string[] UIndexGroupNameList { get; set; }
|
||||||
|
|
||||||
private bool _IsArray;
|
private bool _IsArray;
|
||||||
public bool IsArray
|
public bool IsArray
|
||||||
{
|
{
|
||||||
|
@@ -28,7 +28,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
#region DDL
|
#region DDL
|
||||||
bool AddDefaultValue(string tableName,string columnName,string defaultValue);
|
bool AddDefaultValue(string tableName,string columnName,string defaultValue);
|
||||||
bool CreateIndex(string tableName, string [] columnNames);
|
bool CreateIndex(string tableName, string [] columnNames, bool isUnique=false);
|
||||||
bool DropTable(string tableName);
|
bool DropTable(string tableName);
|
||||||
bool TruncateTable(string tableName);
|
bool TruncateTable(string tableName);
|
||||||
bool TruncateTable<T>();
|
bool TruncateTable<T>();
|
||||||
|
@@ -62,7 +62,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0}({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0}({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
@@ -271,9 +271,9 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return base.AddColumn(tableName, columnInfo);
|
return base.AddColumn(tableName, columnInfo);
|
||||||
}
|
}
|
||||||
public override bool CreateIndex(string tableName, string[] columnNames)
|
public override bool CreateIndex(string tableName, string[] columnNames, bool isUnique = false)
|
||||||
{
|
{
|
||||||
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it => (it + "abc").Substring(0, 3))));
|
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it => (it + "abc").Substring(0, 3))), isUnique ? "UNIQUE" : "");
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -178,7 +178,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0} ({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0} ({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
|
@@ -250,7 +250,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0} ({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0} ({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0}({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0}({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
@@ -271,9 +271,9 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return base.AddColumn(tableName,columnInfo);
|
return base.AddColumn(tableName,columnInfo);
|
||||||
}
|
}
|
||||||
public override bool CreateIndex(string tableName, string[] columnNames)
|
public override bool CreateIndex(string tableName, string[] columnNames, bool isUnique=false)
|
||||||
{
|
{
|
||||||
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it=>(it+"abc").Substring(0,3))));
|
string sql = string.Format(CreateIndexSql, tableName, string.Join(",", columnNames), string.Join("_", columnNames.Select(it=>(it+"abc").Substring(0,3))), isUnique ? "UNIQUE" : "");
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -178,7 +178,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE INDEX Index_{0}_{2} ON {0} ({1})";
|
return "CREATE {3} INDEX Index_{0}_{2} ON {0} ({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
|
@@ -249,7 +249,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "CREATE NONCLUSTERED INDEX Index_{0}_{2} ON {0}({1})";
|
return "CREATE {3} NONCLUSTERED INDEX Index_{0}_{2} ON {0}({1})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string AddDefaultValueSql
|
protected override string AddDefaultValueSql
|
||||||
|
Reference in New Issue
Block a user