Skip to content

Commit

Permalink
update sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
area363 committed Nov 8, 2023
1 parent 8062f2e commit cd1e0a4
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions NineChronicles.DataProvider.Tools/SubCommand/MySqlMigration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,42 +302,6 @@ public void Migration(
var arenaSheet = outputState.GetSheet<ArenaSheet>();
var arenaData = arenaSheet.GetRoundByBlockIndex(tip.Index);

BARDbName = $"{BARDbName}_{arenaData.ChampionshipId}_{arenaData.Round}";
Console.WriteLine("1");
connection.Open();
var stm33 =
$@"CREATE TABLE IF NOT EXISTS `data_provider`.`{BARDbName}` (
`BlockIndex` bigint NOT NULL,
`AgentAddress` varchar(100) NOT NULL,
`AvatarAddress` varchar(100) NOT NULL,
`AvatarLevel` int NOT NULL,
`ChampionshipId` int NOT NULL,
`Round` int NOT NULL,
`ArenaType` varchar(100) NOT NULL,
`Score` int NOT NULL,
`WinCount` int NOT NULL,
`MedalCount` int NOT NULL,
`LossCount` int NOT NULL,
`Ticket` int NOT NULL,
`PurchasedTicketCount` int NOT NULL,
`TicketResetCount` int NOT NULL,
`EntranceFee` bigint NOT NULL,
`TicketPrice` bigint NOT NULL,
`AdditionalTicketPrice` bigint NOT NULL,
`RequiredMedalCount` int NOT NULL,
`StartBlockIndex` bigint NOT NULL,
`EndBlockIndex` bigint NOT NULL,
`Ranking` int NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `fk_BattleArenaRanking_Agent1_idx` (`AgentAddress`),
KEY `fk_BattleArenaRanking_AvatarAddress1_idx` (`AvatarAddress`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;";

var cmd33 = new MySqlCommand(stm33, connection);
cmd33.CommandTimeout = 300;
cmd33.ExecuteScalar();
connection.Close();

Console.WriteLine("2");
var prevArenaEndIndex = arenaData.StartBlockIndex - 1;
var prevArenaData = arenaSheet.GetRoundByBlockIndex(prevArenaEndIndex);
Expand Down Expand Up @@ -560,6 +524,42 @@ public void Migration(
Console.WriteLine($"Finalize {fbBARDbName} & {fbUSDbName} Tables Complete!");
}

BARDbName = $"{BARDbName}_{arenaData.ChampionshipId}_{arenaData.Round}";
Console.WriteLine("1");
connection.Open();
var stm33 =
$@"CREATE TABLE IF NOT EXISTS `data_provider`.`{BARDbName}` (
`BlockIndex` bigint NOT NULL,
`AgentAddress` varchar(100) NOT NULL,
`AvatarAddress` varchar(100) NOT NULL,
`AvatarLevel` int NOT NULL,
`ChampionshipId` int NOT NULL,
`Round` int NOT NULL,
`ArenaType` varchar(100) NOT NULL,
`Score` int NOT NULL,
`WinCount` int NOT NULL,
`MedalCount` int NOT NULL,
`LossCount` int NOT NULL,
`Ticket` int NOT NULL,
`PurchasedTicketCount` int NOT NULL,
`TicketResetCount` int NOT NULL,
`EntranceFee` bigint NOT NULL,
`TicketPrice` bigint NOT NULL,
`AdditionalTicketPrice` bigint NOT NULL,
`RequiredMedalCount` int NOT NULL,
`StartBlockIndex` bigint NOT NULL,
`EndBlockIndex` bigint NOT NULL,
`Ranking` int NOT NULL,
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `fk_BattleArenaRanking_Agent1_idx` (`AgentAddress`),
KEY `fk_BattleArenaRanking_AvatarAddress1_idx` (`AvatarAddress`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;";

var cmd33 = new MySqlCommand(stm33, connection);
cmd33.CommandTimeout = 300;
cmd33.ExecuteScalar();
connection.Close();

foreach (var avatar in avatars)
{
try
Expand Down

0 comments on commit cd1e0a4

Please sign in to comment.