针对迁移分表tails为空的情况判断[#195]

This commit is contained in:
xuejiaming 2022-10-20 13:20:13 +08:00
parent e6d9864c94
commit 25a8c2ed02
2 changed files with 6 additions and 1 deletions

View File

@ -66,10 +66,13 @@ namespace ShardingCore.Helpers
{
if (migrationResult.CommandType == MigrationCommandTypeEnum.TableCommand)
{
if (migrationResult.IsShardingCommand)
{
migrationCommands.Remove(aAddCmd);
}
//如果是分表
if (shardingCmds.IsNotEmpty())
{
migrationCommands.Remove(aAddCmd);
//针对builder的原始表进行移除
shardingCmds.ForEach(aShardingCmd =>
{
@ -154,6 +157,7 @@ namespace ShardingCore.Helpers
if (migrationResult.InDataSource && !string.IsNullOrWhiteSpace(absTableName) &&
existsShardingTables.ContainsKey(absTableName))
{
migrationResult.IsShardingCommand = true;
var shardings = existsShardingTables[absTableName];
shardings.ForEach(aShardingTable =>
{

View File

@ -5,5 +5,6 @@ namespace ShardingCore.Helpers
{
public MigrationCommandTypeEnum CommandType { get; set; } = MigrationCommandTypeEnum.OtherCommand;
public bool InDataSource { get; set; } = true;
public bool IsShardingCommand { get; set; }
}
}