Migrate online matching
This commit is contained in:
parent
728415902b
commit
46d9a63a45
67
Application/Dto/Game/OnlineMatchEntryDto.cs
Normal file
67
Application/Dto/Game/OnlineMatchEntryDto.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
namespace Application.Dto.Game;
|
||||||
|
|
||||||
|
public class OnlineMatchEntryDto
|
||||||
|
{
|
||||||
|
[XmlAttribute(AttributeName = "id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "machine_id")]
|
||||||
|
public long MachineId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "event_id")]
|
||||||
|
public long EventId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "matching_id")]
|
||||||
|
public long MatchId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "entry_no")]
|
||||||
|
public long EntryId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "entry_start")]
|
||||||
|
public string StartTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "status")]
|
||||||
|
public long Status { get; set; } = 1;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "card_id")]
|
||||||
|
public long CardId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "player_name")]
|
||||||
|
public string PlayerName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "avatar_id")]
|
||||||
|
public long AvatarId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "title_id")]
|
||||||
|
public long TitleId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "class_id")]
|
||||||
|
public long ClassId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "group_id")]
|
||||||
|
public long GroupId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "tenpo_id")]
|
||||||
|
public long TenpoId { get; set; } = 1337;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "tenpo_name")]
|
||||||
|
public string TenpoName { get; set; } = "GCLocalServer";
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "pref_id")]
|
||||||
|
public long PrefId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "pref")]
|
||||||
|
public string Pref { get; set; } = "nesys";
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "message_id")]
|
||||||
|
public long MessageId { get; set; }
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "matching_timeout")]
|
||||||
|
public long MatchTimeout { get; set; } = 99;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "matching_wait_time")]
|
||||||
|
public long MatchWaitTime { get; set; } = 10;
|
||||||
|
|
||||||
|
[XmlElement(ElementName = "matching_remaining_time")]
|
||||||
|
public long MatchRemainingTime { get; set; } = 89;
|
||||||
|
}
|
@ -1,15 +1,92 @@
|
|||||||
namespace Application.Game.Card.OnlineMatching;
|
using Application.Common.Helpers;
|
||||||
|
using Domain.Entities;
|
||||||
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Game.Card.OnlineMatching;
|
||||||
|
|
||||||
public record StartOnlineMatchingCommand(long CardId, string Data) : IRequestWrapper<string>;
|
public record StartOnlineMatchingCommand(long CardId, string Data) : IRequestWrapper<string>;
|
||||||
|
|
||||||
public class StartOnlineMatchingCommandHandler : RequestHandlerBase<StartOnlineMatchingCommand, string>
|
public class StartOnlineMatchingCommandHandler : RequestHandlerBase<StartOnlineMatchingCommand, string>
|
||||||
{
|
{
|
||||||
public StartOnlineMatchingCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
private const int MAX_RETRY = 5;
|
||||||
|
|
||||||
|
private const string MATCH_ENRTY_XPATH = "/root/online_matching";
|
||||||
|
|
||||||
|
private const string RECORD_XPATH = $"{MATCH_ENRTY_XPATH}/record";
|
||||||
|
|
||||||
|
private readonly ILogger<StartOnlineMatchingCommandHandler> logger;
|
||||||
|
|
||||||
|
public StartOnlineMatchingCommandHandler(ICardDependencyAggregate aggregate, ILogger<StartOnlineMatchingCommandHandler> logger) : base(aggregate)
|
||||||
{
|
{
|
||||||
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<ServiceResult<string>> Handle(StartOnlineMatchingCommand request, CancellationToken cancellationToken)
|
public override async Task<ServiceResult<string>> Handle(StartOnlineMatchingCommand request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var dto = request.Data.DeserializeCardData<OnlineMatchEntryDto>();
|
||||||
|
dto.CardId = request.CardId;
|
||||||
|
dto.StartTime = TimeHelper.CurrentTimeToString();
|
||||||
|
dto.MatchTimeout = 20;
|
||||||
|
dto.MatchRemainingTime = 5;
|
||||||
|
dto.MatchWaitTime = 5;
|
||||||
|
dto.Status = 1;
|
||||||
|
var entry = dto.DtoToOnlineMatchEntry();
|
||||||
|
|
||||||
|
var matchId = await CardDbContext.OnlineMatches.CountAsync(cancellationToken);
|
||||||
|
for (int i = 0; i < MAX_RETRY; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var onlineMatch = await CardDbContext.OnlineMatches
|
||||||
|
.Include(match => match.Entries)
|
||||||
|
.FirstOrDefaultAsync(match => match.IsOpen && match.Entries.Count < 4, cancellationToken);
|
||||||
|
string result;
|
||||||
|
if (onlineMatch is not null)
|
||||||
|
{
|
||||||
|
entry.EntryId = onlineMatch.Entries.Count;
|
||||||
|
onlineMatch.Entries.Add(entry);
|
||||||
|
onlineMatch.Guid = Guid.NewGuid();
|
||||||
|
await CardDbContext.SaveChangesAsync(cancellationToken);
|
||||||
|
result = onlineMatch.Entries.Select((matchEntry, id) =>
|
||||||
|
{
|
||||||
|
var entryDto = matchEntry.OnlineMatchEntryToDto();
|
||||||
|
entryDto.Id = id;
|
||||||
|
return entryDto;
|
||||||
|
}).SerializeCardDataList(RECORD_XPATH);
|
||||||
|
return new ServiceResult<string>(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.EntryId = 0;
|
||||||
|
onlineMatch = new OnlineMatch
|
||||||
|
{
|
||||||
|
MatchId = matchId,
|
||||||
|
Entries = { entry },
|
||||||
|
Guid = Guid.NewGuid(),
|
||||||
|
IsOpen = true
|
||||||
|
};
|
||||||
|
CardDbContext.OnlineMatches.Add(onlineMatch);
|
||||||
|
await CardDbContext.SaveChangesAsync(cancellationToken);
|
||||||
|
result = onlineMatch.Entries.Select((matchEntry, id) =>
|
||||||
|
{
|
||||||
|
var entryDto = matchEntry.OnlineMatchEntryToDto();
|
||||||
|
entryDto.Id = id;
|
||||||
|
return entryDto;
|
||||||
|
}).SerializeCardDataList(RECORD_XPATH);
|
||||||
|
return new ServiceResult<string>(result);
|
||||||
|
}
|
||||||
|
catch (DbUpdateConcurrencyException e)
|
||||||
|
{
|
||||||
|
logger.LogWarning(e, "Concurrent DB update when starting online match");
|
||||||
|
}
|
||||||
|
catch (DbUpdateException e)
|
||||||
|
when (e.InnerException != null
|
||||||
|
&& e.InnerException.Message.StartsWith("Cannot insert duplicate key row in object"))
|
||||||
|
{
|
||||||
|
logger.LogWarning(e, "Concurrent insert when starting online match");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.LogError("Cannot update DB after {Number} trials for online match!", MAX_RETRY);
|
||||||
|
return ServiceResult.Failed<string>(ServiceError.DatabaseSaveFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,78 @@
|
|||||||
namespace Application.Game.Card.OnlineMatching;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Application.Game.Card.OnlineMatching;
|
||||||
|
|
||||||
public record UpdateOnlineMatchingCommand(long CardId, string Data) : IRequestWrapper<string>;
|
public record UpdateOnlineMatchingCommand(long CardId, string Data) : IRequestWrapper<string>;
|
||||||
|
|
||||||
public class UpdateOnlineMatchingCommandHandler : RequestHandlerBase<UpdateOnlineMatchingCommand, string>
|
public class UpdateOnlineMatchingCommandHandler : RequestHandlerBase<UpdateOnlineMatchingCommand, string>
|
||||||
{
|
{
|
||||||
public UpdateOnlineMatchingCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
private readonly ILogger<UpdateOnlineMatchingCommandHandler> logger;
|
||||||
|
|
||||||
|
private const string MATCH_ENRTY_XPATH = "/root/online_matching";
|
||||||
|
|
||||||
|
private const string RECORD_XPATH = $"{MATCH_ENRTY_XPATH}/record";
|
||||||
|
|
||||||
|
private const int MAX_RETRY = 5;
|
||||||
|
|
||||||
|
public UpdateOnlineMatchingCommandHandler(ICardDependencyAggregate aggregate,
|
||||||
|
ILogger<UpdateOnlineMatchingCommandHandler> logger) : base(aggregate)
|
||||||
{
|
{
|
||||||
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<ServiceResult<string>> Handle(UpdateOnlineMatchingCommand request, CancellationToken cancellationToken)
|
[SuppressMessage("ReSharper.DPA", "DPA0006: Large number of DB commands")]
|
||||||
|
public override async Task<ServiceResult<string>> Handle(UpdateOnlineMatchingCommand request,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var data = request.Data.DeserializeCardData<OnlineMatchEntryDto>();
|
||||||
|
for (int i = 0; i < MAX_RETRY; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var match = await CardDbContext.OnlineMatches
|
||||||
|
.Include(onlineMatch => onlineMatch.Entries)
|
||||||
|
.FirstOrDefaultAsync(onlineMatch =>
|
||||||
|
onlineMatch.MatchId == data.MatchId, cancellationToken);
|
||||||
|
if (match is null)
|
||||||
|
{
|
||||||
|
logger.LogWarning("Match id {MatchId} not found", data.MatchId);
|
||||||
|
return ServiceResult.Failed<string>(ServiceError.CustomMessage("Match with this id does not exist"));
|
||||||
|
}
|
||||||
|
|
||||||
|
match.Entries.ForEach(entry =>
|
||||||
|
{
|
||||||
|
if (entry.CardId == request.CardId)
|
||||||
|
{
|
||||||
|
entry.MessageId = data.MessageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.MatchRemainingTime--;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (match.Entries.TrueForAll(entry => entry.MatchRemainingTime <= 0))
|
||||||
|
{
|
||||||
|
match.Entries.ForEach(entry => entry.Status = 3);
|
||||||
|
match.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
match.Guid = Guid.NewGuid();
|
||||||
|
|
||||||
|
await CardDbContext.SaveChangesAsync(cancellationToken);
|
||||||
|
var result = match.Entries.Select((matchEntry, id) =>
|
||||||
|
{
|
||||||
|
var entryDto = matchEntry.OnlineMatchEntryToDto();
|
||||||
|
entryDto.Id = id;
|
||||||
|
return entryDto;
|
||||||
|
}).SerializeCardDataList(RECORD_XPATH);
|
||||||
|
return new ServiceResult<string>(result);
|
||||||
|
}
|
||||||
|
catch (DbUpdateConcurrencyException e)
|
||||||
|
{
|
||||||
|
logger.LogWarning(e, "Concurrent DB update when starting online match");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.LogError("Cannot update DB after {Number} trials for online match!", MAX_RETRY);
|
||||||
|
return ServiceResult.Failed<string>(ServiceError.DatabaseSaveFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,12 +4,21 @@ public record UploadOnlineMatchingResultCommand(long CardId, string Data) : IReq
|
|||||||
|
|
||||||
public class UploadOnlineMatchingResultCommandHandler : RequestHandlerBase<UploadOnlineMatchingResultCommand, string>
|
public class UploadOnlineMatchingResultCommandHandler : RequestHandlerBase<UploadOnlineMatchingResultCommand, string>
|
||||||
{
|
{
|
||||||
|
private const string XPATH = "/root/online_battle_result";
|
||||||
|
|
||||||
public UploadOnlineMatchingResultCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
public UploadOnlineMatchingResultCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<ServiceResult<string>> Handle(UploadOnlineMatchingResultCommand request, CancellationToken cancellationToken)
|
public override Task<ServiceResult<string>> Handle(UploadOnlineMatchingResultCommand request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var result = new OnlineMatchingResult { Status = 1 }.SerializeCardData(XPATH);
|
||||||
|
return Task.FromResult(new ServiceResult<string>(result));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OnlineMatchingResult
|
||||||
|
{
|
||||||
|
[XmlElement(ElementName = "status")]
|
||||||
|
public int Status { get; set; }
|
||||||
}
|
}
|
@ -38,7 +38,7 @@ public class GetDataQueryHandler : IRequestHandler<GetDataQuery, string>
|
|||||||
}
|
}
|
||||||
|
|
||||||
response = $"count={count}\n" +
|
response = $"count={count}\n" +
|
||||||
"nexttime=180\n" +
|
"nexttime=1\n" +
|
||||||
$"{dataString}";
|
$"{dataString}";
|
||||||
|
|
||||||
return Task.FromResult(response);
|
return Task.FromResult(response);
|
||||||
|
@ -19,6 +19,10 @@ public interface ICardDbContext
|
|||||||
public DbSet<MonthlyScoreRank> MonthlyScoreRanks { get; set; }
|
public DbSet<MonthlyScoreRank> MonthlyScoreRanks { get; set; }
|
||||||
|
|
||||||
public DbSet<ShopScoreRank> ShopScoreRanks { get; set; }
|
public DbSet<ShopScoreRank> ShopScoreRanks { get; set; }
|
||||||
|
|
||||||
|
public DbSet<OnlineMatch> OnlineMatches { get; set; }
|
||||||
|
|
||||||
|
public DbSet<OnlineMatchEntry> OnlineMatchEntries { get; set; }
|
||||||
|
|
||||||
public Task<int> SaveChangesAsync(CancellationToken cancellationToken);
|
public Task<int> SaveChangesAsync(CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
@ -38,5 +38,13 @@ public class MaintainNullValuesJob : IJob
|
|||||||
var count = await cardDbContext.SaveChangesAsync(new CancellationToken());
|
var count = await cardDbContext.SaveChangesAsync(new CancellationToken());
|
||||||
|
|
||||||
logger.LogInformation("Updated {Count} entries in card detail table", count);
|
logger.LogInformation("Updated {Count} entries in card detail table", count);
|
||||||
|
|
||||||
|
logger.LogInformation("Starting closing unfinished matches");
|
||||||
|
var matches = await cardDbContext.OnlineMatches.Where(match => match.IsOpen == true).ToListAsync();
|
||||||
|
matches.ForEach(match => match.IsOpen = false);
|
||||||
|
cardDbContext.OnlineMatches.UpdateRange(matches);
|
||||||
|
count = await cardDbContext.SaveChangesAsync(new CancellationToken());
|
||||||
|
|
||||||
|
logger.LogInformation("Closed {Count} matches", count);
|
||||||
}
|
}
|
||||||
}
|
}
|
17
Application/Mappers/OnlineMatchMapper.cs
Normal file
17
Application/Mappers/OnlineMatchMapper.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using Domain.Entities;
|
||||||
|
using Riok.Mapperly.Abstractions;
|
||||||
|
|
||||||
|
namespace Application.Mappers;
|
||||||
|
|
||||||
|
[Mapper]
|
||||||
|
public static partial class OnlineMatchMapper
|
||||||
|
{
|
||||||
|
public static partial OnlineMatchEntryDto OnlineMatchEntryToDto(this OnlineMatchEntry entry);
|
||||||
|
|
||||||
|
public static partial OnlineMatchEntry DtoToOnlineMatchEntry(this OnlineMatchEntryDto entryDto);
|
||||||
|
|
||||||
|
private static string DateTimeToString(DateTime dateTime)
|
||||||
|
{
|
||||||
|
return dateTime.ToString("yyyy/MM/dd hh:mm:ss");
|
||||||
|
}
|
||||||
|
}
|
@ -5,4 +5,8 @@ public class OnlineMatch
|
|||||||
public long MatchId { get; set; }
|
public long MatchId { get; set; }
|
||||||
|
|
||||||
public List<OnlineMatchEntry> Entries { get; set; } = new();
|
public List<OnlineMatchEntry> Entries { get; set; } = new();
|
||||||
|
|
||||||
|
public bool IsOpen { get; set; }
|
||||||
|
|
||||||
|
public Guid Guid { get; set; }
|
||||||
}
|
}
|
@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedProject", "SharedProj
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GCRelayServer", "GCRelayServer\GCRelayServer.csproj", "{268178DF-6345-4D9E-A389-9E809CBF39C9}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GCRelayServer", "GCRelayServer\GCRelayServer.csproj", "{268178DF-6345-4D9E-A389-9E809CBF39C9}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatchServer", "MatchServer\MatchServer.csproj", "{CB91C3D3-ED69-4DC6-A205-B262A08BEE49}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MainServer", "MainServer\MainServer.csproj", "{B8C6CA7E-5E58-43BC-8E03-84306916DE39}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MainServer", "MainServer\MainServer.csproj", "{B8C6CA7E-5E58-43BC-8E03-84306916DE39}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Application\Application.csproj", "{B0691233-0D7E-4694-8923-646E7A3BDBF4}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Application\Application.csproj", "{B0691233-0D7E-4694-8923-646E7A3BDBF4}"
|
||||||
@ -41,10 +39,6 @@ Global
|
|||||||
{268178DF-6345-4D9E-A389-9E809CBF39C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{268178DF-6345-4D9E-A389-9E809CBF39C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{268178DF-6345-4D9E-A389-9E809CBF39C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{268178DF-6345-4D9E-A389-9E809CBF39C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{268178DF-6345-4D9E-A389-9E809CBF39C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{268178DF-6345-4D9E-A389-9E809CBF39C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{CB91C3D3-ED69-4DC6-A205-B262A08BEE49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{CB91C3D3-ED69-4DC6-A205-B262A08BEE49}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{CB91C3D3-ED69-4DC6-A205-B262A08BEE49}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{CB91C3D3-ED69-4DC6-A205-B262A08BEE49}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{B8C6CA7E-5E58-43BC-8E03-84306916DE39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{B8C6CA7E-5E58-43BC-8E03-84306916DE39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{B8C6CA7E-5E58-43BC-8E03-84306916DE39}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B8C6CA7E-5E58-43BC-8E03-84306916DE39}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B8C6CA7E-5E58-43BC-8E03-84306916DE39}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B8C6CA7E-5E58-43BC-8E03-84306916DE39}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
480
Infrastructure/Migrations/20230226141744_AddOnlineMatchTables.Designer.cs
generated
Normal file
480
Infrastructure/Migrations/20230226141744_AddOnlineMatchTables.Designer.cs
generated
Normal file
@ -0,0 +1,480 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Infrastructure.Persistence;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(CardDbContext))]
|
||||||
|
[Migration("20230226141744_AddOnlineMatchTables")]
|
||||||
|
partial class AddOnlineMatchTables
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.CardBdatum", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("card_id");
|
||||||
|
|
||||||
|
b.Property<string>("Bdata")
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasColumnName("bdata");
|
||||||
|
|
||||||
|
b.Property<long>("BdataSize")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("bdata_size");
|
||||||
|
|
||||||
|
b.HasKey("CardId");
|
||||||
|
|
||||||
|
b.ToTable("card_bdata", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.CardDetail", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("card_id");
|
||||||
|
|
||||||
|
b.Property<long>("Pcol1")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("pcol1");
|
||||||
|
|
||||||
|
b.Property<long>("Pcol2")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("pcol2");
|
||||||
|
|
||||||
|
b.Property<long>("Pcol3")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("pcol3");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol1")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("fcol1");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol2")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("fcol2");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol3")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("fcol3");
|
||||||
|
|
||||||
|
b.Property<string>("LastPlayTenpoId")
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasColumnName("last_play_tenpo_id");
|
||||||
|
|
||||||
|
b.Property<long?>("LastPlayTime")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("last_play_time");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreBi1")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_bi1");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreI1")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_i1");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreUi1")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_ui1");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreUi2")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_ui2");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreUi3")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_ui3");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreUi4")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_ui4");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreUi5")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_ui5");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreUi6")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_ui6");
|
||||||
|
|
||||||
|
b.HasKey("CardId", "Pcol1", "Pcol2", "Pcol3");
|
||||||
|
|
||||||
|
b.ToTable("card_detail", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.CardMain", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("card_id");
|
||||||
|
|
||||||
|
b.Property<string>("AchieveStatus")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasColumnName("achieve_status");
|
||||||
|
|
||||||
|
b.Property<string>("Created")
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasColumnName("created");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol1")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("fcol1");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol2")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("fcol2");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol3")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("fcol3");
|
||||||
|
|
||||||
|
b.Property<string>("Modified")
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasColumnName("modified");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT")
|
||||||
|
.HasColumnName("player_name");
|
||||||
|
|
||||||
|
b.Property<long>("ScoreI1")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("score_i1");
|
||||||
|
|
||||||
|
b.HasKey("CardId");
|
||||||
|
|
||||||
|
b.ToTable("card_main", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.CardPlayCount", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("card_id");
|
||||||
|
|
||||||
|
b.Property<long>("LastPlayedTime")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("last_played_time");
|
||||||
|
|
||||||
|
b.Property<long>("PlayCount")
|
||||||
|
.HasColumnType("INTEGER")
|
||||||
|
.HasColumnName("play_count");
|
||||||
|
|
||||||
|
b.HasKey("CardId");
|
||||||
|
|
||||||
|
b.ToTable("CardPlayCount", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.GlobalScoreRank", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Area")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("AreaId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("AvatarId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol1")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("LastPlayTenpoId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Pref")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("PrefId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("Rank")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TenpoName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("TitleId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("TotalScore")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("CardId");
|
||||||
|
|
||||||
|
b.ToTable("GlobalScoreRank", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.MonthlyScoreRank", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Area")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("AreaId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("AvatarId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol1")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("LastPlayTenpoId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Pref")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("PrefId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("Rank")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TenpoName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("TitleId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("TotalScore")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("CardId");
|
||||||
|
|
||||||
|
b.ToTable("MonthlyScoreRank", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatch", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("MatchId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("Guid")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOpen")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("MatchId");
|
||||||
|
|
||||||
|
b.ToTable("OnlineMatches");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("MatchId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("EntryId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("AvatarId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("ClassId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("EventId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("GroupId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MachineId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MatchRemainingTime")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MatchTimeout")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MatchWaitTime")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MessageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Pref")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("PrefId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartTime")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("Status")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("TenpoId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TenpoName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("TitleId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("MatchId", "EntryId");
|
||||||
|
|
||||||
|
b.ToTable("OnlineMatchEntries");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.PlayNumRank", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("MusicId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Artist")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("PlayCount")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("PrevRank")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("PrevRank2")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Rank")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Rank2")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.HasKey("MusicId");
|
||||||
|
|
||||||
|
b.ToTable("PlayNumRank", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.ShopScoreRank", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("Area")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("AreaId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("AvatarId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("Fcol1")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("LastPlayTenpoId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Pref")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<int>("PrefId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("Rank")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TenpoName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Title")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("TitleId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("TotalScore")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("CardId");
|
||||||
|
|
||||||
|
b.ToTable("ShopScoreRank", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Domain.Entities.OnlineMatch", null)
|
||||||
|
.WithMany("Entries")
|
||||||
|
.HasForeignKey("MatchId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatch", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Entries");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddOnlineMatchTables : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<long>(
|
||||||
|
name: "last_play_time",
|
||||||
|
table: "card_detail",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(long),
|
||||||
|
oldType: "INTEGER");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OnlineMatches",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
MatchId = table.Column<long>(type: "INTEGER", nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
IsOpen = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||||
|
Guid = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OnlineMatches", x => x.MatchId);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OnlineMatchEntries",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
MatchId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
EntryId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
MachineId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
EventId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
StartTime = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
Status = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
CardId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
PlayerName = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
AvatarId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
TitleId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
ClassId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
GroupId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
TenpoId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
TenpoName = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
PrefId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
Pref = table.Column<string>(type: "TEXT", nullable: false),
|
||||||
|
MessageId = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
MatchTimeout = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
MatchWaitTime = table.Column<long>(type: "INTEGER", nullable: false),
|
||||||
|
MatchRemainingTime = table.Column<long>(type: "INTEGER", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OnlineMatchEntries", x => new { x.MatchId, x.EntryId });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OnlineMatchEntries_OnlineMatches_MatchId",
|
||||||
|
column: x => x.MatchId,
|
||||||
|
principalTable: "OnlineMatches",
|
||||||
|
principalColumn: "MatchId",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OnlineMatchEntries");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OnlineMatches");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<long>(
|
||||||
|
name: "last_play_time",
|
||||||
|
table: "card_detail",
|
||||||
|
type: "INTEGER",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0L,
|
||||||
|
oldClrType: typeof(long),
|
||||||
|
oldType: "INTEGER",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
using Infrastructure.Persistence;
|
using Infrastructure.Persistence;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
@ -69,7 +70,7 @@ namespace Infrastructure.Migrations
|
|||||||
.HasColumnType("TEXT")
|
.HasColumnType("TEXT")
|
||||||
.HasColumnName("last_play_tenpo_id");
|
.HasColumnName("last_play_tenpo_id");
|
||||||
|
|
||||||
b.Property<long>("LastPlayTime")
|
b.Property<long?>("LastPlayTime")
|
||||||
.HasColumnType("INTEGER")
|
.HasColumnType("INTEGER")
|
||||||
.HasColumnName("last_play_time");
|
.HasColumnName("last_play_time");
|
||||||
|
|
||||||
@ -282,6 +283,94 @@ namespace Infrastructure.Migrations
|
|||||||
b.ToTable("MonthlyScoreRank", (string)null);
|
b.ToTable("MonthlyScoreRank", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatch", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("MatchId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<Guid>("Guid")
|
||||||
|
.IsConcurrencyToken()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<bool>("IsOpen")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("MatchId");
|
||||||
|
|
||||||
|
b.ToTable("OnlineMatches");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b =>
|
||||||
|
{
|
||||||
|
b.Property<long>("MatchId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("EntryId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("AvatarId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("CardId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("ClassId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("EventId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("GroupId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MachineId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MatchRemainingTime")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MatchTimeout")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MatchWaitTime")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("MessageId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("PlayerName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<string>("Pref")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("PrefId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartTime")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("Status")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<long>("TenpoId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<string>("TenpoName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<long>("TitleId")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.HasKey("MatchId", "EntryId");
|
||||||
|
|
||||||
|
b.ToTable("OnlineMatchEntries");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Domain.Entities.PlayNumRank", b =>
|
modelBuilder.Entity("Domain.Entities.PlayNumRank", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("MusicId")
|
b.Property<int>("MusicId")
|
||||||
@ -368,6 +457,20 @@ namespace Infrastructure.Migrations
|
|||||||
|
|
||||||
b.ToTable("ShopScoreRank", (string)null);
|
b.ToTable("ShopScoreRank", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatchEntry", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Domain.Entities.OnlineMatch", null)
|
||||||
|
.WithMany("Entries")
|
||||||
|
.HasForeignKey("MatchId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Domain.Entities.OnlineMatch", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Entries");
|
||||||
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ public partial class CardDbContext : DbContext, ICardDbContext
|
|||||||
|
|
||||||
public virtual DbSet<ShopScoreRank> ShopScoreRanks { get; set; } = null!;
|
public virtual DbSet<ShopScoreRank> ShopScoreRanks { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual DbSet<OnlineMatch> OnlineMatches { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual DbSet<OnlineMatchEntry> OnlineMatchEntries { get; set; } = null!;
|
||||||
|
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@ -202,6 +206,23 @@ public partial class CardDbContext : DbContext, ICardDbContext
|
|||||||
entity.Property(e => e.PlayerName);
|
entity.Property(e => e.PlayerName);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<OnlineMatch>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.MatchId);
|
||||||
|
|
||||||
|
entity.Property(e => e.MatchId).ValueGeneratedNever();
|
||||||
|
entity.Property(e => e.Guid).IsConcurrencyToken();
|
||||||
|
|
||||||
|
entity.HasMany(e => e.Entries)
|
||||||
|
.WithOne()
|
||||||
|
.HasForeignKey(p => p.MatchId);
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<OnlineMatchEntry>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => new { e.MatchId, e.EntryId });
|
||||||
|
});
|
||||||
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
OnModelCreatingPartial(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"Events": {
|
"Events": {
|
||||||
"UseEvents": false,
|
"UseEvents": true,
|
||||||
"EventFiles": [
|
"EventFiles": [
|
||||||
{
|
{
|
||||||
"FileName": "event_103_20201125.evt",
|
"FileName": "event_103_20201125.evt",
|
||||||
|
BIN
MainServer/Database/card.db3-shm
Normal file
BIN
MainServer/Database/card.db3-shm
Normal file
Binary file not shown.
BIN
MainServer/Database/card.db3-wal
Normal file
BIN
MainServer/Database/card.db3-wal
Normal file
Binary file not shown.
@ -108,6 +108,11 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Remove="BundledCertificates\Import.ps1" />
|
||||||
|
<Content Include="BundledCertificates\Import.ps1">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user