Browse Source

BackUpTable BUG

pull/12/MERGE
610262374@qq.com 6 years ago
parent
commit
4ddd98bdc0
  1. 2
      Src/Asp.Net/SqlServerTest/Demos/5_CodeFirst.cs
  2. 2
      Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs
  3. 9
      Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs
  4. 2
      Src/Asp.Net/SqliteTest/Config.cs
  5. BIN
      Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite
  6. 2
      Src/Asp.Net/SqliteTest/Demos/5_CodeFirst.cs

2
Src/Asp.Net/SqlServerTest/Demos/5_CodeFirst.cs

@ -49,7 +49,7 @@ namespace OrmTest.Demo
//db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2)); //db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2));
//No backup table //No backup table
db.CodeFirst.InitTables(typeof(CodeTable),typeof(CodeTable2)); db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2));
} }
} }
} }

2
Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs

@ -195,7 +195,7 @@ namespace SqlSugar
{ {
oldTableName = this.SqlBuilder.GetTranslationTableName(oldTableName); oldTableName = this.SqlBuilder.GetTranslationTableName(oldTableName);
newTableName = this.SqlBuilder.GetTranslationTableName(newTableName); newTableName = this.SqlBuilder.GetTranslationTableName(newTableName);
string sql = string.Format(this.BackupTableSql, newTableName, oldTableName, maxBackupDataRows); string sql = string.Format(this.BackupTableSql, maxBackupDataRows, newTableName, oldTableName);
this.Context.Ado.ExecuteCommand(sql); this.Context.Ado.ExecuteCommand(sql);
return true; return true;
} }

9
Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs

@ -209,7 +209,14 @@ namespace SqlSugar
return result; return result;
} }
} }
public override bool BackupTable(string oldTableName, string newTableName, int maxBackupDataRows = int.MaxValue)
{
oldTableName = this.SqlBuilder.GetTranslationTableName(oldTableName);
newTableName = this.SqlBuilder.GetTranslationTableName(newTableName);
string sql = string.Format(this.BackupTableSql, newTableName, oldTableName, maxBackupDataRows);
this.Context.Ado.ExecuteCommand(sql);
return true;
}
public override bool CreateTable(string tableName, List<DbColumnInfo> columns, bool isCreatePrimaryKey = true) public override bool CreateTable(string tableName, List<DbColumnInfo> columns, bool isCreatePrimaryKey = true)
{ {
if (columns.HasValue()) if (columns.HasValue())

2
Src/Asp.Net/SqliteTest/Config.cs

@ -8,6 +8,6 @@ namespace OrmTest
{ {
public class Config public class Config
{ {
public static string ConnectionString = @"DataSource=F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\Src\Asp.Net\SqliteTest\DataBase\SqlSugar4xTest.sqlite"; public static string ConnectionString = @"DataSource=F:\GIT\SqlSugar\Src\Asp.Net\SqliteTest\DataBase\SqlSugar4xTest.sqlite";
} }
} }

BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite

Binary file not shown.

2
Src/Asp.Net/SqliteTest/Demos/5_CodeFirst.cs

@ -46,7 +46,7 @@ namespace OrmTest.Demo
//db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2)); //db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2));
//No backup table //No backup table
db.CodeFirst.InitTables(typeof(CodeTable),typeof(CodeTable2)); db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2));
} }
} }
} }

Loading…
Cancel
Save