fix migration

add ignore general rows in files_bunch_objects
This commit is contained in:
Anton Suhorukov 2022-12-29 12:07:41 +03:00
parent ad4ae24191
commit 6142c450af

View File

@ -122,7 +122,7 @@ public class MigrationCreator
{
foreach (var table in tablesToProcess)
{
if (table.Name == "files_thirdparty_account" || table.Name == "files_bunch_objects" || table.Name == "files_thirdparty_id_mapping" || table.Name == "core_subscription" || table.Name == "files_security")
if (table.Name == "files_thirdparty_account" || table.Name == "files_thirdparty_id_mapping" || table.Name == "core_subscription" || table.Name == "files_security")
{
continue;
}
@ -161,6 +161,11 @@ public class MigrationCreator
{
ChangeAlias(data);
ChangeName(data);
}
if (data.TableName == "files_bunch_objects")
{
RemoveGeneralBunchObjects(data);
}
using (var file = _tempStream.Create())
@ -198,8 +203,21 @@ public class MigrationCreator
Console.WriteLine(ex.Message);
newAlias = Console.ReadLine();
}
}
}
var q = data.Rows[0];
data.Rows[0]["alias"] = newAlias;
}
private void RemoveGeneralBunchObjects(DataTable data)
{
for(var i = 0; i < data.Rows.Count; i++)
{
if (data.Rows[i]["right_node"].ToString().EndsWith('/'))
{
data.Rows.RemoveAt(i);
i--;
}
}
}
private List<string> GetAliases()