From da5c18e07e86b98b6d66d41b6d8b8c4f2977751d Mon Sep 17 00:00:00 2001 From: Benjamin Sutas Date: Thu, 28 May 2026 00:14:25 +1000 Subject: [PATCH 1/4] feat: Introduce ObjectServiceHostOptions for in-process web server configuration - Added ObjectServiceHostOptions class to encapsulate configuration options for the ObjectServiceHost. - Updated ObjectService.csproj to include Microsoft.EntityFrameworkCore.Design package. - Refactored Program.cs to utilize ObjectServiceHost for configuration and setup. - Enhanced BaseDataTableRouteHandler to support generic DbContext types. - Updated various route handlers to use LocoDbContext and IdentityContext appropriately. - Modified ServerFolderManager to initialize from a database context instead of an index file. - Improved folder structure management for server objects. - Cleaned up unused references and improved test cases to align with new structure. --- Dat/Services/DatFolderScanner.cs | 123 + Dat/Services/LocalObjectIndexService.cs | 167 + DataQuery/DataQuery.csproj | 2 +- DataQuery/Program.cs | 192 +- DatabaseTools/DatabaseTools.csproj | 1 - .../Services/DatabaseHelperScripts.cs | 41 +- .../Services/DatabaseImportService.cs | 18 +- Definitions/Database/ClientLocoDbContext.cs | 15 + .../Database/DataTables/TblDatObject.cs | 5 + Definitions/Database/Identity/TblUser.cs | 4 +- Definitions/Database/IdentityContext.cs | 31 + Definitions/Database/LocoDbContext.cs | 65 +- Definitions/Database/ServerLocoDbContext.cs | 15 + Definitions/FileLocation.cs | 11 + .../20250112060337_InitialCreate.Designer.cs | 589 ---- .../20250112060337_InitialCreate.cs | 560 ---- ...20250602004808_AddObjectLookup.Designer.cs | 630 ---- .../20250602004808_AddObjectLookup.cs | 71 - .../20250603100806_AddStringTable.Designer.cs | 668 ---- .../20250603100806_AddStringTable.cs | 181 -- ...50603102909_StringTableRowName.Designer.cs | 668 ---- .../20250603102909_StringTableRowName.cs | 21 - ...0603103118_StringTableRowName2.Designer.cs | 669 ---- .../20250603103118_StringTableRowName2.cs | 69 - .../20250615084605_AddIdentity.Designer.cs | 911 ------ .../Migrations/20250615084605_AddIdentity.cs | 220 -- ...250616030006_RenameStringTable.Designer.cs | 938 ------ .../20250616030006_RenameStringTable.cs | 87 - .../20250617071719_intTolong.Designer.cs | 911 ------ .../Migrations/20250617071719_intTolong.cs | 116 - ...0250617081552_LinkUserToAuthor.Designer.cs | 936 ------ .../20250617081552_LinkUserToAuthor.cs | 193 -- ...250617085044_LinkUserToAuthor2.Designer.cs | 925 ------ .../20250617085044_LinkUserToAuthor2.cs | 88 - ...250627061229_ReaddAvailability.Designer.cs | 928 ------ .../20250627061229_ReaddAvailability.cs | 22 - ...20250630032403_SubObjectTables.Designer.cs | 1819 ----------- .../20250630032403_SubObjectTables.cs | 1136 ------- .../20250630043418_SubObjectTPT.Designer.cs | 1474 --------- .../Migrations/20250630043418_SubObjectTPT.cs | 999 ------ .../20250630053103_SubObjectFK.Designer.cs | 1849 ------------ .../Migrations/20250630053103_SubObjectFK.cs | 1524 ---------- ...0250630053246_SubObjectFKIndex.Designer.cs | 1951 ------------ .../20250630053246_SubObjectFKIndex.cs | 357 --- ...0250630055651_SubObjectClimate.Designer.cs | 1972 ------------ .../20250630055651_SubObjectClimate.cs | 94 - .../20250701061712_SubObjectAll.Designer.cs | 2683 ----------------- .../Migrations/20250701061712_SubObjectAll.cs | 2613 ---------------- ...0250702021058_SubObjectUpdates.Designer.cs | 2641 ---------------- .../20250702021058_SubObjectUpdates.cs | 180 -- .../20250709052238_DefaultDateTime.cs | 1623 ---------- .../20251228122835_AddTblObjectMissing.cs | 155 - .../20260527111450_Initial.Designer.cs | 270 ++ .../Identity/20260527111450_Initial.cs | 224 ++ .../Identity/IdentityContextModelSnapshot.cs | 267 ++ .../20260527112357_Initial.Designer.cs} | 342 +-- .../Migrations/Loco/20260527112357_Initial.cs | 2016 +++++++++++++ ...27120443_AddDatObjectFileName.Designer.cs} | 269 +- .../20260527120443_AddDatObjectFileName.cs | 28 + .../LocoDbContextModelSnapshot.cs} | 267 +- Definitions/ObjectIndex.cs | 62 + Definitions/ObjectIndexEntry.cs | 22 + Gui/App.axaml.cs | 17 +- Gui/Converters/EnumToMaterialIconConverter.cs | 2 +- Gui/EditorSettings.cs | 38 +- Gui/Gui.csproj | 4 +- Gui/Models/FileLocation.cs | 10 - Gui/Models/FileSystemItems.cs | 2 +- Gui/Models/ObjectEditorContext.cs | 354 ++- Gui/Models/ObjectServiceModel.cs | 1 + Gui/ObjectServiceClient.cs | 58 +- Gui/Services/EmbeddedHostState.cs | 20 + Gui/Services/EmbeddedObjectServiceHost.cs | 186 ++ Gui/Services/ObjectServiceClient.cs | 139 + Gui/Services/RemoteServerMonitor.cs | 138 + Gui/Services/RemoteServerState.cs | 16 + .../EditorSettingsWindowViewModel.cs | 25 + Gui/ViewModels/FolderTreeViewModel.cs | 2 +- Gui/ViewModels/Loco/BaseFileViewModel.cs | 1 + Gui/ViewModels/Loco/G1ViewModel.cs | 1 + Gui/ViewModels/Loco/IFileViewModel.cs | 1 + Gui/ViewModels/Loco/MusicViewModel.cs | 1 + Gui/ViewModels/Loco/ObjectEditorViewModel.cs | 1 + Gui/ViewModels/Loco/SCV5ViewModel.cs | 7 +- Gui/ViewModels/Loco/SoundEffectsViewModel.cs | 1 + Gui/ViewModels/MainWindowViewModel.cs | 136 + .../ObjectSelectionWindowViewModel.cs | 2 +- .../RequiredObjectsListViewModel.cs | 8 +- Gui/Views/MainWindow.axaml | 12 + Index/Index.csproj | 19 - Index/ObjectIndex.cs | 205 -- ObjectEditor.sln | 14 - ObjectService/Hosting/ObjectServiceHost.cs | 289 ++ .../Hosting/ObjectServiceHostOptions.cs | 42 + ObjectService/ObjectService.csproj | 6 +- ObjectService/Program.cs | 213 +- .../BaseDataTableRouteHandler.cs | 24 +- .../RouteHandlers/ITableRouteConfig.cs | 8 +- .../TableHandlers/AuthorRouteHandler.cs | 4 +- .../TableHandlers/LicenceRouteHandler.cs | 4 +- .../ObjectMissingRouteHandler.cs | 4 +- .../TableHandlers/ObjectRouteHandler.cs | 6 +- .../TableHandlers/RoleRouteHandler.cs | 8 +- .../TableHandlers/TagRouteHandler.cs | 4 +- .../TableHandlers/UserRouteHandler.cs | 8 +- .../TableHandlers/V1RouteHandler.cs | 1 - ObjectService/ServerFolderManager.cs | 72 +- Tests/Models/ViewModelTests.cs | 2 +- .../Routes/ObjectPackRoutesTest.cs | 1 - .../Routes/ObjectRoutesTest.cs | 4 +- 110 files changed, 4879 insertions(+), 35170 deletions(-) create mode 100644 Dat/Services/DatFolderScanner.cs create mode 100644 Dat/Services/LocalObjectIndexService.cs create mode 100644 Definitions/Database/ClientLocoDbContext.cs create mode 100644 Definitions/Database/IdentityContext.cs create mode 100644 Definitions/Database/ServerLocoDbContext.cs create mode 100644 Definitions/FileLocation.cs delete mode 100644 Definitions/Migrations/20250112060337_InitialCreate.Designer.cs delete mode 100644 Definitions/Migrations/20250112060337_InitialCreate.cs delete mode 100644 Definitions/Migrations/20250602004808_AddObjectLookup.Designer.cs delete mode 100644 Definitions/Migrations/20250602004808_AddObjectLookup.cs delete mode 100644 Definitions/Migrations/20250603100806_AddStringTable.Designer.cs delete mode 100644 Definitions/Migrations/20250603100806_AddStringTable.cs delete mode 100644 Definitions/Migrations/20250603102909_StringTableRowName.Designer.cs delete mode 100644 Definitions/Migrations/20250603102909_StringTableRowName.cs delete mode 100644 Definitions/Migrations/20250603103118_StringTableRowName2.Designer.cs delete mode 100644 Definitions/Migrations/20250603103118_StringTableRowName2.cs delete mode 100644 Definitions/Migrations/20250615084605_AddIdentity.Designer.cs delete mode 100644 Definitions/Migrations/20250615084605_AddIdentity.cs delete mode 100644 Definitions/Migrations/20250616030006_RenameStringTable.Designer.cs delete mode 100644 Definitions/Migrations/20250616030006_RenameStringTable.cs delete mode 100644 Definitions/Migrations/20250617071719_intTolong.Designer.cs delete mode 100644 Definitions/Migrations/20250617071719_intTolong.cs delete mode 100644 Definitions/Migrations/20250617081552_LinkUserToAuthor.Designer.cs delete mode 100644 Definitions/Migrations/20250617081552_LinkUserToAuthor.cs delete mode 100644 Definitions/Migrations/20250617085044_LinkUserToAuthor2.Designer.cs delete mode 100644 Definitions/Migrations/20250617085044_LinkUserToAuthor2.cs delete mode 100644 Definitions/Migrations/20250627061229_ReaddAvailability.Designer.cs delete mode 100644 Definitions/Migrations/20250627061229_ReaddAvailability.cs delete mode 100644 Definitions/Migrations/20250630032403_SubObjectTables.Designer.cs delete mode 100644 Definitions/Migrations/20250630032403_SubObjectTables.cs delete mode 100644 Definitions/Migrations/20250630043418_SubObjectTPT.Designer.cs delete mode 100644 Definitions/Migrations/20250630043418_SubObjectTPT.cs delete mode 100644 Definitions/Migrations/20250630053103_SubObjectFK.Designer.cs delete mode 100644 Definitions/Migrations/20250630053103_SubObjectFK.cs delete mode 100644 Definitions/Migrations/20250630053246_SubObjectFKIndex.Designer.cs delete mode 100644 Definitions/Migrations/20250630053246_SubObjectFKIndex.cs delete mode 100644 Definitions/Migrations/20250630055651_SubObjectClimate.Designer.cs delete mode 100644 Definitions/Migrations/20250630055651_SubObjectClimate.cs delete mode 100644 Definitions/Migrations/20250701061712_SubObjectAll.Designer.cs delete mode 100644 Definitions/Migrations/20250701061712_SubObjectAll.cs delete mode 100644 Definitions/Migrations/20250702021058_SubObjectUpdates.Designer.cs delete mode 100644 Definitions/Migrations/20250702021058_SubObjectUpdates.cs delete mode 100644 Definitions/Migrations/20250709052238_DefaultDateTime.cs delete mode 100644 Definitions/Migrations/20251228122835_AddTblObjectMissing.cs create mode 100644 Definitions/Migrations/Identity/20260527111450_Initial.Designer.cs create mode 100644 Definitions/Migrations/Identity/20260527111450_Initial.cs create mode 100644 Definitions/Migrations/Identity/IdentityContextModelSnapshot.cs rename Definitions/Migrations/{20250709052238_DefaultDateTime.Designer.cs => Loco/20260527112357_Initial.Designer.cs} (89%) create mode 100644 Definitions/Migrations/Loco/20260527112357_Initial.cs rename Definitions/Migrations/{20251228122835_AddTblObjectMissing.Designer.cs => Loco/20260527120443_AddDatObjectFileName.Designer.cs} (89%) create mode 100644 Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs rename Definitions/Migrations/{LocoDbModelSnapshot.cs => Loco/LocoDbContextModelSnapshot.cs} (89%) create mode 100644 Definitions/ObjectIndex.cs create mode 100644 Definitions/ObjectIndexEntry.cs delete mode 100644 Gui/Models/FileLocation.cs create mode 100644 Gui/Services/EmbeddedHostState.cs create mode 100644 Gui/Services/EmbeddedObjectServiceHost.cs create mode 100644 Gui/Services/ObjectServiceClient.cs create mode 100644 Gui/Services/RemoteServerMonitor.cs create mode 100644 Gui/Services/RemoteServerState.cs delete mode 100644 Index/Index.csproj delete mode 100644 Index/ObjectIndex.cs create mode 100644 ObjectService/Hosting/ObjectServiceHost.cs create mode 100644 ObjectService/Hosting/ObjectServiceHostOptions.cs diff --git a/Dat/Services/DatFolderScanner.cs b/Dat/Services/DatFolderScanner.cs new file mode 100644 index 00000000..e3668924 --- /dev/null +++ b/Dat/Services/DatFolderScanner.cs @@ -0,0 +1,123 @@ +using Dat.Converters; +using Dat.Data; +using Dat.FileParsing; +using Dat.Types; +using Definitions.ObjectModels.Objects.Vehicle; +using Definitions.ObjectModels.Types; +using Microsoft.Extensions.Logging; +using System.Collections.Concurrent; +using System.IO.Hashing; + +namespace Dat.Services; + +// Plain result for a single scanned .dat file. Mirrors the metadata the old +// ObjectIndexEntry stored, but lives in the Dat project so it can be produced +// without any database dependencies. The LocalObjectIndexService (in Definitions) +// is responsible for translating these into TblObject + TblDatObject rows. +public record DatFileScanResult( + string FullPath, + string RelativePath, + string DatName, + uint DatChecksum, + ulong xxHash3, + ObjectType ObjectType, + ObjectSource ObjectSource, + DateOnly CreatedDate, + DateOnly ModifiedDate, + VehicleType? VehicleType); + +public record DatFolderScanResults( + IReadOnlyList Succeeded, + IReadOnlyList Failed); + +public static class DatFolderScanner +{ + // Parses the in-memory bytes of a single .dat file and returns its metadata, or + // null if the headers are invalid / parsing fails. Does not touch the disk other + // than to read file timestamps from absoluteFilename. + public static DatFileScanResult? TryScanBytes(string absoluteFilename, string relativeFilename, byte[] data, ILogger logger) + { + if (!SawyerStreamReader.TryGetHeadersFromBytes(data, out var hdrs, logger)) + { + logger.LogError("{RelativeFilename} must have valid S5 and Object headers to be scanned", relativeFilename); + return null; + } + + var xxHash3 = XxHash3.HashToUInt64(data); + var source = OriginalObjectFiles.GetFileSource(hdrs.S5.Name, hdrs.S5.Checksum, hdrs.S5.ObjectSource); + var createdTime = DateOnly.FromDateTime(File.GetCreationTimeUtc(absoluteFilename)); + var modifiedTime = DateOnly.FromDateTime(File.GetLastWriteTimeUtc(absoluteFilename)); + var objType = hdrs.S5.ObjectType.Convert(); + + VehicleType? vType = null; + if (objType == ObjectType.Vehicle) + { + // only need 4 bytes since vehicle type is in the 4th byte of a vehicle object + var remainingData = data[(S5Header.StructLength + ObjectHeader.StructLength)..]; + var decoded = SawyerStreamReader.Decode(hdrs.Obj.Encoding, remainingData, 4); + vType = (VehicleType)decoded[3]; + } + + return new DatFileScanResult(absoluteFilename, relativeFilename, hdrs.S5.Name, hdrs.S5.Checksum, xxHash3, objType, source, createdTime, modifiedTime, vType); + } + + // Scans every .dat file under the given directory in parallel and returns + // (succeeded, failed) lists. Files that cannot be read or whose headers are + // invalid are added to the failed list; everything else produces a scan result. + public static Task ScanDirectoryAsync(string directory, ILogger logger, IProgress? progress = null, CancellationToken cancellationToken = default) + => Task.Run(() => ScanDirectory(directory, logger, progress, cancellationToken), cancellationToken); + + public static DatFolderScanResults ScanDirectory(string directory, ILogger logger, IProgress? progress = null, CancellationToken cancellationToken = default) + { + var files = SawyerStreamUtils.GetDatFilesInDirectory(directory).ToArray(); + return ScanFiles(directory, files, logger, progress, cancellationToken); + } + + public static DatFolderScanResults ScanFiles(string directory, IReadOnlyList relativeFiles, ILogger logger, IProgress? progress = null, CancellationToken cancellationToken = default) + { + ConcurrentQueue succeeded = []; + ConcurrentQueue failed = []; + var totalFiles = relativeFiles.Count; + + _ = Parallel.ForEach( + relativeFiles, + new ParallelOptions { CancellationToken = cancellationToken }, + file => ScanOne(directory, file, succeeded, failed, totalFiles, progress, logger)); + + return new DatFolderScanResults([.. succeeded], [.. failed]); + } + + static void ScanOne(string directory, string relativeFilename, ConcurrentQueue succeeded, ConcurrentQueue failed, int totalFiles, IProgress? progress, ILogger logger) + { + var fullFilename = Path.Combine(directory, relativeFilename); + + if (!File.Exists(fullFilename)) + { + failed.Enqueue(relativeFilename); + progress?.Report((succeeded.Count + failed.Count) / (float)totalFiles); + return; + } + + DatFileScanResult? entry = null; + try + { + var bytes = File.ReadAllBytes(fullFilename); + entry = TryScanBytes(fullFilename, relativeFilename, bytes, logger); + } + catch (Exception ex) + { + logger.LogError(ex, "Failed to parse file \"{Filename}\"", relativeFilename); + } + + if (entry == null) + { + failed.Enqueue(relativeFilename); + } + else + { + succeeded.Enqueue(entry); + } + + progress?.Report((succeeded.Count + failed.Count) / (float)totalFiles); + } +} diff --git a/Dat/Services/LocalObjectIndexService.cs b/Dat/Services/LocalObjectIndexService.cs new file mode 100644 index 00000000..00477a74 --- /dev/null +++ b/Dat/Services/LocalObjectIndexService.cs @@ -0,0 +1,167 @@ +using Definitions; +using Definitions.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + +namespace Dat.Services; + +// Database-backed local object index. Replaces the JSON-based ObjectIndex used by +// the editor client. Each scanned .dat file becomes a TblObject (one per unique +// content hash) with one or more TblDatObject rows pointing at it. +// +// The service uses LocoDbContext (the shared object-domain schema). Callers are +// expected to provide a context factory so each operation can scope its own +// short-lived context. +public class LocalObjectIndexService +{ + readonly Func contextFactory; + readonly ILogger logger; + + public LocalObjectIndexService(Func contextFactory, ILogger logger) + { + this.contextFactory = contextFactory; + this.logger = logger; + } + + // Rebuilds the index from scratch by scanning the given directory and + // replacing all existing rows. Existing TblObject/TblDatObject entries are + // deleted before the scan results are inserted. + public async Task RebuildFromFolderAsync(string directory, IProgress? progress = null, CancellationToken cancellationToken = default) + { + var results = await DatFolderScanner.ScanDirectoryAsync(directory, logger, progress, cancellationToken); + await using var db = contextFactory(); + + db.DatObjects.RemoveRange(db.DatObjects); + db.Objects.RemoveRange(db.Objects); + _ = await db.SaveChangesAsync(cancellationToken); + + await InsertScanResultsAsync(db, results.Succeeded, cancellationToken); + + foreach (var f in results.Failed) + { + logger.LogWarning("Failed to scan: {File}", f); + } + } + + // Adds the given relative .dat files (under `directory`) to the index, leaving + // any pre-existing rows untouched. Existing hashes are skipped. + public async Task AddFilesAsync(string directory, IEnumerable relativeFiles, IProgress? progress = null, CancellationToken cancellationToken = default) + { + var results = DatFolderScanner.ScanFiles(directory, [.. relativeFiles], logger, progress, cancellationToken); + await using var db = contextFactory(); + await InsertScanResultsAsync(db, results.Succeeded, cancellationToken); + } + + public async Task TryFindByDatAsync(string datName, uint datChecksum, CancellationToken cancellationToken = default) + { + await using var db = contextFactory(); + var dat = await db.DatObjects.AsNoTracking() + .Include(d => d.Object) + .FirstOrDefaultAsync(d => d.DatName == datName && d.DatChecksum == datChecksum, cancellationToken); + return dat?.Object; + } + + public async Task TryFindByHashAsync(ulong xxHash3, CancellationToken cancellationToken = default) + { + await using var db = contextFactory(); + var dat = await db.DatObjects.AsNoTracking() + .Include(d => d.Object) + .FirstOrDefaultAsync(d => d.xxHash3 == xxHash3, cancellationToken); + return dat?.Object; + } + + // Builds a flat ObjectIndex projection from the DB for binding by the UI and + // for use by anything that previously consumed the JSON ObjectIndex. + public async Task BuildObjectIndexAsync(CancellationToken cancellationToken = default) + { + await using var db = contextFactory(); + var rows = await db.DatObjects.AsNoTracking() + .Include(d => d.Object) + .Select(d => new ObjectIndexEntry( + d.DatName, + d.FileName, + d.Object.Id, + d.DatChecksum, + d.xxHash3, + d.Object.ObjectType, + d.Object.ObjectSource, + d.Object.CreatedDate, + d.Object.ModifiedDate, + d.Object.VehicleType)) + .ToListAsync(cancellationToken); + return new ObjectIndex(rows); + } + + public async Task DeleteByHashAsync(IEnumerable hashes, CancellationToken cancellationToken = default) + { + var hashSet = hashes.ToHashSet(); + await using var db = contextFactory(); + var dats = await db.DatObjects.Where(d => hashSet.Contains(d.xxHash3)).ToListAsync(cancellationToken); + db.DatObjects.RemoveRange(dats); + + // also delete orphaned TblObjects (no remaining DatObjects) + var orphanIds = dats.Select(d => d.ObjectId).Distinct().ToList(); + var orphans = await db.Objects + .Where(o => orphanIds.Contains(o.Id) && !db.DatObjects.Any(d => d.ObjectId == o.Id)) + .ToListAsync(cancellationToken); + db.Objects.RemoveRange(orphans); + + return await db.SaveChangesAsync(cancellationToken); + } + + static async Task InsertScanResultsAsync(LocoDbContext db, IReadOnlyList results, CancellationToken cancellationToken) + { + if (results.Count == 0) + { + return; + } + + // Group by xxHash3: identical content → single TblObject with multiple TblDatObject rows. + var existingHashes = (await db.DatObjects.Select(d => d.xxHash3).ToListAsync(cancellationToken)).ToHashSet(); + + foreach (var group in results.GroupBy(r => r.xxHash3)) + { + if (existingHashes.Contains(group.Key)) + { + continue; + } + + var first = group.First(); + var obj = new TblObject + { + Name = first.DatName, + Description = null, + ObjectType = first.ObjectType, + ObjectSource = first.ObjectSource, + VehicleType = first.VehicleType, + Availability = ObjectAvailability.Unavailable, + CreatedDate = first.CreatedDate, + ModifiedDate = first.ModifiedDate, + SubObjectId = 0, + Authors = [], + Tags = [], + ObjectPacks = [], + DatObjects = [], + StringTable = [], + Licence = null, + }; + _ = db.Objects.Add(obj); + _ = await db.SaveChangesAsync(cancellationToken); // need Id + + foreach (var r in group) + { + obj.DatObjects.Add(new TblDatObject + { + DatName = r.DatName, + DatChecksum = r.DatChecksum, + xxHash3 = r.xxHash3, + FileName = r.RelativePath, + ObjectId = obj.Id, + Object = obj, + }); + } + } + + _ = await db.SaveChangesAsync(cancellationToken); + } +} diff --git a/DataQuery/DataQuery.csproj b/DataQuery/DataQuery.csproj index 02017247..ddf9a6e2 100644 --- a/DataQuery/DataQuery.csproj +++ b/DataQuery/DataQuery.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/DataQuery/Program.cs b/DataQuery/Program.cs index 08d46af5..4ca504cd 100644 --- a/DataQuery/Program.cs +++ b/DataQuery/Program.cs @@ -1,190 +1,4 @@ -// See https://aka.ms/new-console-template for more information -using OpenLoco.Common.Logging; -using Common.Logging; -using OpenLoco.Dat.Data; -using Common.Logging; -using OpenLoco.Dat.FileParsing; -using Common.Logging; -using OpenLoco.Dat.Objects; -using Common.Logging; -using OpenLoco.Definitions.Database; -using Common.Logging; -using System.Reflection; -using Common.Logging; +// DataQuery: legacy one-off research console app. All queries previously here have been +// removed; use the DatabaseTools project for current dev/query tooling. -var dir = "Q:\\Games\\Locomotion\\Server\\Objects"; -var logger = new Logger(); -var index = ObjectIndex.LoadOrCreateIndex(dir, logger); - -//QueryCostIndices(dir, logger, index); -//QueryCargoCategories(dir, logger, index); -//QueryVehicleBodyUnkSprites(dir, logger, index); -//QueryIndustryHasShadows(dir, logger, index); - -Console.WriteLine("done"); - -Console.ReadLine(); - -static void QueryIndustryHasShadows(string dir, Logger logger, ObjectIndex index) -{ - var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource)>(); - - foreach (var obj in index.Objects.Where(x => x.ObjectType == ObjectType.Industry)) - { - try - { - var o = SawyerStreamReader.LoadFullObjectFromFile(Path.Combine(dir, obj.FileName), logger); - if (o?.LocoObject != null) - { - var struc = (IndustryObject)o.Value.LocoObject.Object; - var header = o.Value.DatFileInfo.S5Header; - var source = OriginalObjectFiles.GetFileSource(header.Name, header.Checksum); - - if (struc.Flags.HasFlag(IndustryObjectFlags.HasShadows)) - { - results.Add((obj, source)); - } - } - } - catch (Exception ex) - { - Console.WriteLine($"{obj.FileName} - {ex.Message}"); - } - } - - Console.WriteLine(results.Count); - - const string csvHeader = "DatName, ObjectSource"; - var lines = results - .OrderBy(x => x.Obj.DisplayName) - .Select(x => string.Join(',', x.Obj.DisplayName, x.ObjectSource)); - - File.WriteAllLines("vehicleBodiesWithUnkSpritesFlag.csv", [csvHeader, .. lines]); -} - -static void QueryVehicleBodyUnkSprites(string dir, Logger logger, ObjectIndex index) -{ - var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource)>(); - - foreach (var obj in index.Objects.Where(x => x.ObjectType == ObjectType.Vehicle)) - { - try - { - var o = SawyerStreamReader.LoadFullObjectFromFile(Path.Combine(dir, obj.FileName), logger); - if (o?.LocoObject != null) - { - var struc = (VehicleObject)o.Value.LocoObject.Object; - var header = o.Value.DatFileInfo.S5Header; - var source = OriginalObjectFiles.GetFileSource(header.Name, header.Checksum); - - if (struc.Flags.HasFlag(VehicleObjectFlags.AlternatingCarSprite)) - { - results.Add((obj, source)); - } - } - } - catch (Exception ex) - { - Console.WriteLine($"{obj.FileName} - {ex.Message}"); - } - } - - Console.WriteLine(results.Count); - - const string csvHeader = "DatName, ObjectSource"; - var lines = results - .OrderBy(x => x.Obj.DisplayName) - .Select(x => string.Join(',', x.Obj.DisplayName, x.ObjectSource)); - - File.WriteAllLines("vehicleBodiesWithUnkSpritesFlag.csv", [csvHeader, .. lines]); -} - -static void QueryCargoCategories(string dir, Logger logger, ObjectIndex index) -{ - var results = new List<(ObjectIndexEntry Obj, CargoCategory CargoCategory, string LocalisedName, ObjectSource ObjectSource)>(); - - foreach (var obj in index.Objects.Where(x => x.ObjectType == ObjectType.Cargo)) - { - try - { - var o = SawyerStreamReader.LoadFullObjectFromFile(Path.Combine(dir, obj.FileName), logger); - if (o?.LocoObject != null) - { - var struc = (CargoObject)o.Value.LocoObject.Object; - - var header = o.Value.DatFileInfo.S5Header; - var source = OriginalObjectFiles.GetFileSource(header.Name, header.Checksum); - - results.Add((obj, struc.CargoCategory, o.Value.LocoObject.StringTable.Table["Name"][LanguageId.English_UK], source)); - } - } - catch (Exception ex) - { - Console.WriteLine($"{obj.FileName} - {ex.Message}"); - } - } - - Console.WriteLine("writing to file"); - - const string csvHeader = "DatName, CargoCategory, LocalisedName, ObjectSource"; - var lines = results - .OrderBy(x => x.Obj.DisplayName) - .Select(x => string.Join(',', x.Obj.DisplayName, (int)x.CargoCategory, x.LocalisedName, x.ObjectSource)); - File.WriteAllLines("cargoCategories.csv", [csvHeader, .. lines]); -} - -static void QueryCostIndices(string dir, Logger logger, ObjectIndex index) -{ - var results = new List<(ObjectIndexEntry Obj, byte CostIndex, short? RunCostIndex)>(); - - foreach (var obj in index.Objects) - { - try - { - var o = SawyerStreamReader.LoadFullObjectFromFile(Path.Combine(dir, obj.FileName), logger); - if (o?.LocoObject != null) - { - var struc = o.Value.LocoObject.Object; - var type = struc.GetType(); - - var costIndexProperty = type.GetProperty("CostIndex", BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); - var paymentIndexProperty = type.GetProperty("PaymentIndex", BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); - var runCostIndexProperty = type.GetProperty("RunCostIndex", BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); - - byte? costIndex = null; - byte? runCostIndex = null; - - if (costIndexProperty?.PropertyType == typeof(byte) && costIndexProperty.GetValue(struc) is byte costIndexValue) - { - costIndex = costIndexValue; - } - else if (paymentIndexProperty?.PropertyType == typeof(byte) && paymentIndexProperty.GetValue(struc) is byte paymentIndexValue) - { - costIndex = paymentIndexValue; - } - - if (runCostIndexProperty?.PropertyType == typeof(byte) && runCostIndexProperty.GetValue(struc) is byte runCostIndexValue) - { - runCostIndex = runCostIndexValue; - } - - if (costIndex != null) - { - results.Add((obj, costIndex.Value, runCostIndex)); - } - } - } - catch (Exception ex) - { - Console.WriteLine($"{obj.FileName} - {ex.Message}"); - } - } - - Console.WriteLine("writing to file"); - - const string header = "DatName, ObjectType, CostIndex, RunCostIndex"; - var lines = results - .OrderBy(x => x.Obj.DisplayName) - .Select(x => string.Join(',', x.Obj.DisplayName, x.Obj.ObjectType, x.CostIndex, x.RunCostIndex)); - File.WriteAllLines("costIndex.csv", [header, .. lines]); -} +Console.WriteLine("DataQuery: no-op. See DatabaseTools for current dev/query tooling."); diff --git a/DatabaseTools/DatabaseTools.csproj b/DatabaseTools/DatabaseTools.csproj index 615d9b53..4472fde6 100644 --- a/DatabaseTools/DatabaseTools.csproj +++ b/DatabaseTools/DatabaseTools.csproj @@ -26,7 +26,6 @@ - diff --git a/DatabaseTools/Services/DatabaseHelperScripts.cs b/DatabaseTools/Services/DatabaseHelperScripts.cs index cade92d4..9972d58b 100644 --- a/DatabaseTools/Services/DatabaseHelperScripts.cs +++ b/DatabaseTools/Services/DatabaseHelperScripts.cs @@ -48,7 +48,7 @@ using Definitions.ObjectModels.Objects.Wall; using Definitions.ObjectModels.Objects.Water; using Definitions.ObjectModels.Types; -using Index; +using Definitions; using Microsoft.EntityFrameworkCore; using System.IO.Hashing; using System.Reflection; @@ -103,7 +103,8 @@ public static Task QueryBuildingVar_AC(ToolsSettings settings, Action lo { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, int var_ac)>(); @@ -143,7 +144,8 @@ public static Task QueryBuildingProducedQuantity(ToolsSettings settings, Action< { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, (string ProducedName, int ProducedQuantity))>(); @@ -179,7 +181,8 @@ public static Task QueryHeadquarters(ToolsSettings settings, Action log) { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource)>(); @@ -216,7 +219,8 @@ public static Task QueryCostIndex(ToolsSettings settings, Action log) => { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource, ObjectType ObjectType, byte CostIndex)>(); @@ -267,7 +271,8 @@ public static Task QueryTrackStationOneSidedTrack(ToolsSettings settings, Action { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource, List Flags)>(); @@ -323,7 +328,8 @@ public static Task QueryIndustryHasShadows(ToolsSettings settings, Action(); @@ -361,7 +367,8 @@ public static Task QueryVehicleBodyUnkSprites(ToolsSettings settings, Action(); @@ -399,7 +406,8 @@ public static Task QueryCargoCategories(ToolsSettings settings, Action l { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, CargoCategory CargoCategory, string LocalisedName, ObjectSource ObjectSource)>(); @@ -433,7 +441,8 @@ public static Task QueryCostIndices(ToolsSettings settings, Action log) { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, byte CostIndex, short? RunCostIndex)>(); @@ -492,7 +501,8 @@ public static async Task WritexxHash3(ToolsSettings settings, Action log ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var objects = await db.DatObjects.Include(x => x.Object).ToListAsync(); @@ -522,7 +532,8 @@ public static async Task FixObjectDescriptions(ToolsSettings settings, Action x.DatObjects).ToListAsync(); @@ -565,7 +576,8 @@ public static async Task WriteStringTable(ToolsSettings settings, Action ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); var objects = await db.Objects .Include(x => x.DatObjects) @@ -622,7 +634,8 @@ public static async Task SetupSubObjects(ToolsSettings settings, Action { var dir = settings.ObjectDirectory; var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(dir, logger); + using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + var index = ObjectIndex.FromDb(indexDb); using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); diff --git a/DatabaseTools/Services/DatabaseImportService.cs b/DatabaseTools/Services/DatabaseImportService.cs index b7a79e37..1e680a94 100644 --- a/DatabaseTools/Services/DatabaseImportService.cs +++ b/DatabaseTools/Services/DatabaseImportService.cs @@ -5,7 +5,6 @@ using Definitions.Database; using Definitions.ObjectModels.Types; using Definitions.SourceData; -using Index; using Microsoft.EntityFrameworkCore; using System.Text.Json; using System.Text.Json.Serialization; @@ -143,20 +142,20 @@ public static Task SeedAllAsync(ToolsSettings settings, Action log) if (!db.Objects.Any() && File.Exists(objectMetadataJson) && Directory.Exists(settings.ObjectDirectory)) { log("Seeding Objects"); - var index = ObjectIndex.LoadOrCreateIndex(settings.ObjectDirectory, logger); + var scan = Dat.Services.DatFolderScanner.ScanDirectory(settings.ObjectDirectory, logger); var objectMetadata = JsonSerializer.Deserialize>(File.ReadAllText(objectMetadataJson), jsonOptions); var objectMetadataDict = objectMetadata!.ToDictionary(x => x.InternalName, x => x); var gameReleaseDate = new DateOnly(2004, 09, 07); - foreach (var objIndex in index!.Objects.DistinctBy(x => (x.DisplayName, x.DatChecksum))) + foreach (var objIndex in scan.Succeeded.DistinctBy(x => (x.DatName, x.DatChecksum))) { - if (!objectMetadataDict.TryGetValue(objIndex.DisplayName, out var meta)) + if (!objectMetadataDict.TryGetValue(objIndex.DatName, out var meta)) { meta = new ObjectMetadata(Guid.NewGuid().ToString(), null, [], [], [], null, ObjectAvailability.Available, DateOnly.UtcToday, null, DateOnly.UtcToday, ObjectSource.Custom); - objectMetadataDict.Add(objIndex.DisplayName, meta); + objectMetadataDict.Add(objIndex.DatName, meta); } - var filename = Path.Combine(settings.ObjectDirectory, objIndex.FileName); + var filename = objIndex.FullPath; var creationTime = objIndex.ObjectSource is ObjectSource.LocomotionSteam or ObjectSource.LocomotionGoG ? gameReleaseDate : DateOnly.FromDateTime(File.GetLastWriteTimeUtc(filename)); @@ -186,9 +185,10 @@ public static Task SeedAllAsync(ToolsSettings settings, Action log) var addedObj = db.Add(tblLocoObject); var locoLookupTbl = new TblDatObject { - DatName = objIndex.DisplayName, - DatChecksum = objIndex.DatChecksum.Value, - xxHash3 = objIndex.xxHash3.Value, + DatName = objIndex.DatName, + DatChecksum = objIndex.DatChecksum, + xxHash3 = objIndex.xxHash3, + FileName = objIndex.RelativePath, ObjectId = addedObj.Entity.Id, Object = tblLocoObject, }; diff --git a/Definitions/Database/ClientLocoDbContext.cs b/Definitions/Database/ClientLocoDbContext.cs new file mode 100644 index 00000000..5ee8e797 --- /dev/null +++ b/Definitions/Database/ClientLocoDbContext.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; + +namespace Definitions.Database; + +// Client-side projection of the Loco object schema. Used by the GUI's embedded +// ObjectService host so client databases never get ASP.NET Identity tables. +// No extra members today - reserved as the hook point for any future client-only schema. +public class ClientLocoDbContext : BaseLocoDbContext +{ + public ClientLocoDbContext() + { } + + public ClientLocoDbContext(DbContextOptions options) : base(options) + { } +} diff --git a/Definitions/Database/DataTables/TblDatObject.cs b/Definitions/Database/DataTables/TblDatObject.cs index 6f4711e6..34537319 100644 --- a/Definitions/Database/DataTables/TblDatObject.cs +++ b/Definitions/Database/DataTables/TblDatObject.cs @@ -12,6 +12,11 @@ public class TblDatObject : DbIdObject public required ulong xxHash3 { get; set; } // technically a byte[], but we'll use 64-bit int for faster comparison + // Optional path to the .dat file on disk. Used by the local (client-side) index + // to track where each DAT lives in the user's folder. Server stores either the + // relative path under ObjectsCustomFolder or leaves this null. + public string? FileName { get; set; } + public required UniqueObjectId ObjectId { get; set; } // FK property public TblObject Object { get; set; } = null!; // navigation property. a DAT object must ALWAYS reference an OL object diff --git a/Definitions/Database/Identity/TblUser.cs b/Definitions/Database/Identity/TblUser.cs index 13cf22f9..7832c04c 100644 --- a/Definitions/Database/Identity/TblUser.cs +++ b/Definitions/Database/Identity/TblUser.cs @@ -4,6 +4,8 @@ namespace Definitions.Database; public class TblUser : IdentityUser, IHasId { + // FK only - the navigation property is intentionally omitted because TblAuthor lives in + // LocoDbContext while TblUser lives in IdentityContext. Cross-context navigations are + // not supported; consumers should resolve the author via LocoDbContext.Authors.Find(...). public UniqueObjectId? AssociatedAuthorId { get; set; } - public TblAuthor? AssociatedAuthor { get; set; } } diff --git a/Definitions/Database/IdentityContext.cs b/Definitions/Database/IdentityContext.cs new file mode 100644 index 00000000..d286653d --- /dev/null +++ b/Definitions/Database/IdentityContext.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + +namespace Definitions.Database; + +// Holds the ASP.NET Core Identity schema only. Shares the same SQLite file as LocoDbContext +// but tracks migrations in a separate __EFMigrationsHistory_Identity table. +// +// This context is server-only. Clients running purely against LocoDbContext will not have +// Identity tables in their local DB and will not register this context with DI. +public class IdentityContext : IdentityDbContext +{ + public const string MigrationsHistoryTableName = "__EFMigrationsHistory_Identity"; + + public IdentityContext() + { } + + public IdentityContext(DbContextOptions options) : base(options) + { } + + protected override void OnConfiguring(DbContextOptionsBuilder builder) + { + if (!builder.IsConfigured) + { + // Default to the same SQLite file used by LocoDbContext for the design-time/CLI case + _ = builder.UseSqlite( + $"Data Source={LocoDbContext.DefaultDb}", + sql => sql.MigrationsHistoryTable(MigrationsHistoryTableName)); + } + } +} diff --git a/Definitions/Database/LocoDbContext.cs b/Definitions/Database/LocoDbContext.cs index 3d453d51..46a67cd9 100644 --- a/Definitions/Database/LocoDbContext.cs +++ b/Definitions/Database/LocoDbContext.cs @@ -1,9 +1,12 @@ -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace Definitions.Database; -public class LocoDbContext : IdentityDbContext +// Holds the object-domain schema shared by both the server-side and client-side hosting +// modes. Identity tables live in IdentityContext (server-only) and are not part of this +// hierarchy. Use ClientLocoDbContext or ServerLocoDbContext to materialise a concrete +// context; this base class only carries the schema definition. +public abstract class BaseLocoDbContext : DbContext { #region ReferenceData @@ -102,13 +105,13 @@ public class LocoDbContext : IdentityDbContext options) : base(options) + protected BaseLocoDbContext() { } - public const string DefaultDb = "Q:\\Games\\Locomotion\\Database\\loco-test.db"; + protected BaseLocoDbContext(DbContextOptions options) : base(options) + { } protected override void OnConfiguring(DbContextOptionsBuilder builder) { @@ -130,18 +133,26 @@ protected override void OnConfiguring(DbContextOptionsBuilder builder) return null; } - protected override void OnModelCreating(ModelBuilder modelBuilder) + + public bool DoesObjectExist(string datName, uint datChecksum, out TblObject? existingObject) { - base.OnModelCreating(modelBuilder); + // there's a unique constraint on the composite key index (DatName, DatChecksum), so check existence first so no exceptions + // this isn't necessary since we're already filtering in LINQ, but if we were adding to a non-empty database, this would be necessary + var existingEntityInDb = DatObjects + .SingleOrDefault(e => e.DatName == datName && e.DatChecksum == datChecksum)?.Object; - //_ = modelBuilder.Entity() - // .HasAlternateKey(o => new { o.SubObjectId, o.ObjectType }); + var existingEntityInChangeTracker = ChangeTracker.Entries() + .Where(e => e.State == EntityState.Added && e.Entity.GetType() == typeof(TblDatObject)) + .Select(e => e.Entity as TblDatObject) + .SingleOrDefault(e => e!.DatName == datName && e.DatChecksum == datChecksum)?.Object; - // Configure the one-to-many relationship - //modelBuilder.Entity() - // .HasOne(oi => oi.Order) // OrderItem has one Order - // .WithMany(o => o.OrderItems) // Order has many OrderItems - // .HasForeignKey(oi => new { oi.OrderNumber, oi.CustomerCode }); // The composite foreign key on OrderItem + existingObject = existingEntityInDb ?? existingEntityInChangeTracker; + return existingObject != null; + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); _ = modelBuilder.Entity() .Property(b => b.UploadedDate) @@ -156,20 +167,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .Property(b => b.UploadedDate) .HasDefaultValueSql("date('now')"); // this is necessary, it seems like a bug in sqlite } +} - public bool DoesObjectExist(string datName, uint datChecksum, out TblObject? existingObject) - { - // there's a unique constraint on the composite key index (DatName, DatChecksum), so check existence first so no exceptions - // this isn't necessary since we're already filtering in LINQ, but if we were adding to a non-empty database, this would be necessary - var existingEntityInDb = DatObjects - .SingleOrDefault(e => e.DatName == datName && e.DatChecksum == datChecksum)?.Object; - - var existingEntityInChangeTracker = ChangeTracker.Entries() - .Where(e => e.State == EntityState.Added && e.Entity.GetType() == typeof(TblDatObject)) - .Select(e => e.Entity as TblDatObject) - .SingleOrDefault(e => e!.DatName == datName && e.DatChecksum == datChecksum)?.Object; +// Existing concrete context. Kept under this name so that the EF migrations snapshot in +// /Definitions/Migrations/Loco continues to apply without regeneration. Both the standalone +// server and the existing tests/tools still bind to this type at runtime. +public class LocoDbContext : BaseLocoDbContext +{ + public LocoDbContext() + { } - existingObject = existingEntityInDb ?? existingEntityInChangeTracker; - return existingObject != null; - } + public LocoDbContext(DbContextOptions options) : base(options) + { } } diff --git a/Definitions/Database/ServerLocoDbContext.cs b/Definitions/Database/ServerLocoDbContext.cs new file mode 100644 index 00000000..0f5185d6 --- /dev/null +++ b/Definitions/Database/ServerLocoDbContext.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; + +namespace Definitions.Database; + +// Server-side projection of the Loco object schema. Identity tables remain in the +// separate IdentityContext (server-only). No extra members today - reserved as the +// hook point for any future server-only schema additions (e.g. audit logs, jobs). +public class ServerLocoDbContext : BaseLocoDbContext +{ + public ServerLocoDbContext() + { } + + public ServerLocoDbContext(DbContextOptions options) : base(options) + { } +} diff --git a/Definitions/FileLocation.cs b/Definitions/FileLocation.cs new file mode 100644 index 00000000..65941b90 --- /dev/null +++ b/Definitions/FileLocation.cs @@ -0,0 +1,11 @@ +namespace Definitions; + +// Indicates the origin of an object record from the perspective of the editor UI. +// Local = on the user's disk and tracked by the local SQLite index. +// Online = retrieved from a remote ObjectService. +[Flags] +public enum FileLocation +{ + Local, + Online, +} diff --git a/Definitions/Migrations/20250112060337_InitialCreate.Designer.cs b/Definitions/Migrations/20250112060337_InitialCreate.Designer.cs deleted file mode 100644 index 1995957b..00000000 --- a/Definitions/Migrations/20250112060337_InitialCreate.Designer.cs +++ /dev/null @@ -1,589 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250112060337_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.10"); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250112060337_InitialCreate.cs b/Definitions/Migrations/20250112060337_InitialCreate.cs deleted file mode 100644 index 8597328f..00000000 --- a/Definitions/Migrations/20250112060337_InitialCreate.cs +++ /dev/null @@ -1,560 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class InitialCreate : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.CreateTable( - name: "Authors", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_Authors", x => x.Id); - }); - - _ = migrationBuilder.CreateTable( - name: "Licences", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Text = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_Licences", x => x.Id); - }); - - _ = migrationBuilder.CreateTable( - name: "Tags", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_Tags", x => x.Id); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjectPacks", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')") - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjectPacks", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjectPacks_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - _ = migrationBuilder.CreateTable( - name: "Objects", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DatName = table.Column(type: "TEXT", nullable: false), - DatChecksum = table.Column(type: "INTEGER", nullable: false), - ObjectSource = table.Column(type: "INTEGER", nullable: false), - ObjectType = table.Column(type: "INTEGER", nullable: false), - VehicleType = table.Column(type: "INTEGER", nullable: true), - Availability = table.Column(type: "INTEGER", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')") - }, - constraints: table => - { - _ = table.PrimaryKey("PK_Objects", x => x.Id); - _ = table.ForeignKey( - name: "FK_Objects_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - _ = migrationBuilder.CreateTable( - name: "SC5FilePacks", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')") - }, - constraints: table => - { - _ = table.PrimaryKey("PK_SC5FilePacks", x => x.Id); - _ = table.ForeignKey( - name: "FK_SC5FilePacks_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - _ = migrationBuilder.CreateTable( - name: "SC5Files", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ObjectSource = table.Column(type: "INTEGER", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')") - }, - constraints: table => - { - _ = table.PrimaryKey("PK_SC5Files", x => x.Id); - _ = table.ForeignKey( - name: "FK_SC5Files_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - _ = migrationBuilder.CreateTable( - name: "TblAuthorTblObjectPack", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - ObjectPacksId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblAuthorTblObjectPack", x => new { x.AuthorsId, x.ObjectPacksId }); - _ = table.ForeignKey( - name: "FK_TblAuthorTblObjectPack_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblAuthorTblObjectPack_ObjectPacks_ObjectPacksId", - column: x => x.ObjectPacksId, - principalTable: "ObjectPacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblObjectPackTblTag", - columns: table => new - { - ObjectPacksId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblObjectPackTblTag", x => new { x.ObjectPacksId, x.TagsId }); - _ = table.ForeignKey( - name: "FK_TblObjectPackTblTag_ObjectPacks_ObjectPacksId", - column: x => x.ObjectPacksId, - principalTable: "ObjectPacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblObjectPackTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblAuthorTblObject", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - ObjectsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblAuthorTblObject", x => new { x.AuthorsId, x.ObjectsId }); - _ = table.ForeignKey( - name: "FK_TblAuthorTblObject_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblAuthorTblObject_Objects_ObjectsId", - column: x => x.ObjectsId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblObjectTblObjectPack", - columns: table => new - { - ObjectPacksId = table.Column(type: "INTEGER", nullable: false), - ObjectsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblObjectTblObjectPack", x => new { x.ObjectPacksId, x.ObjectsId }); - _ = table.ForeignKey( - name: "FK_TblObjectTblObjectPack_ObjectPacks_ObjectPacksId", - column: x => x.ObjectPacksId, - principalTable: "ObjectPacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", - column: x => x.ObjectsId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblObjectTblTag", - columns: table => new - { - ObjectsId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblObjectTblTag", x => new { x.ObjectsId, x.TagsId }); - _ = table.ForeignKey( - name: "FK_TblObjectTblTag_Objects_ObjectsId", - column: x => x.ObjectsId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblObjectTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblAuthorTblSC5FilePack", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - SC5FilePacksId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblAuthorTblSC5FilePack", x => new { x.AuthorsId, x.SC5FilePacksId }); - _ = table.ForeignKey( - name: "FK_TblAuthorTblSC5FilePack_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblAuthorTblSC5FilePack_SC5FilePacks_SC5FilePacksId", - column: x => x.SC5FilePacksId, - principalTable: "SC5FilePacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblSC5FilePackTblTag", - columns: table => new - { - SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblSC5FilePackTblTag", x => new { x.SC5FilePacksId, x.TagsId }); - _ = table.ForeignKey( - name: "FK_TblSC5FilePackTblTag_SC5FilePacks_SC5FilePacksId", - column: x => x.SC5FilePacksId, - principalTable: "SC5FilePacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblSC5FilePackTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblAuthorTblSC5File", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - SC5FilesId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblAuthorTblSC5File", x => new { x.AuthorsId, x.SC5FilesId }); - _ = table.ForeignKey( - name: "FK_TblAuthorTblSC5File_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblAuthorTblSC5File_SC5Files_SC5FilesId", - column: x => x.SC5FilesId, - principalTable: "SC5Files", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblSC5FileTblSC5FilePack", - columns: table => new - { - SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), - SC5FilesId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblSC5FileTblSC5FilePack", x => new { x.SC5FilePacksId, x.SC5FilesId }); - _ = table.ForeignKey( - name: "FK_TblSC5FileTblSC5FilePack_SC5FilePacks_SC5FilePacksId", - column: x => x.SC5FilePacksId, - principalTable: "SC5FilePacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblSC5FileTblSC5FilePack_SC5Files_SC5FilesId", - column: x => x.SC5FilesId, - principalTable: "SC5Files", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblSC5FileTblTag", - columns: table => new - { - SC5FilesId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblSC5FileTblTag", x => new { x.SC5FilesId, x.TagsId }); - _ = table.ForeignKey( - name: "FK_TblSC5FileTblTag_SC5Files_SC5FilesId", - column: x => x.SC5FilesId, - principalTable: "SC5Files", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_TblSC5FileTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateIndex( - name: "IX_Licences_Name", - table: "Licences", - column: "Name", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectPacks_LicenceId", - table: "ObjectPacks", - column: "LicenceId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectPacks_Name", - table: "ObjectPacks", - column: "Name", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_Objects_DatName_DatChecksum", - table: "Objects", - columns: ["DatName", "DatChecksum"], - unique: true, - descending: [true, false]); - - _ = migrationBuilder.CreateIndex( - name: "IX_Objects_LicenceId", - table: "Objects", - column: "LicenceId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_Objects_Name", - table: "Objects", - column: "Name", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_SC5FilePacks_LicenceId", - table: "SC5FilePacks", - column: "LicenceId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_SC5FilePacks_Name", - table: "SC5FilePacks", - column: "Name", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_SC5Files_LicenceId", - table: "SC5Files", - column: "LicenceId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_SC5Files_Name", - table: "SC5Files", - column: "Name", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_Tags_Name", - table: "Tags", - column: "Name", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblObject_ObjectsId", - table: "TblAuthorTblObject", - column: "ObjectsId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblObjectPack_ObjectPacksId", - table: "TblAuthorTblObjectPack", - column: "ObjectPacksId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblSC5File_SC5FilesId", - table: "TblAuthorTblSC5File", - column: "SC5FilesId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblSC5FilePack_SC5FilePacksId", - table: "TblAuthorTblSC5FilePack", - column: "SC5FilePacksId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblObjectPackTblTag_TagsId", - table: "TblObjectPackTblTag", - column: "TagsId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblObjectTblObjectPack_ObjectsId", - table: "TblObjectTblObjectPack", - column: "ObjectsId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblObjectTblTag_TagsId", - table: "TblObjectTblTag", - column: "TagsId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblSC5FilePackTblTag_TagsId", - table: "TblSC5FilePackTblTag", - column: "TagsId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblSC5FileTblSC5FilePack_SC5FilesId", - table: "TblSC5FileTblSC5FilePack", - column: "SC5FilesId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblSC5FileTblTag_TagsId", - table: "TblSC5FileTblTag", - column: "TagsId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropTable( - name: "TblAuthorTblObject"); - - _ = migrationBuilder.DropTable( - name: "TblAuthorTblObjectPack"); - - _ = migrationBuilder.DropTable( - name: "TblAuthorTblSC5File"); - - _ = migrationBuilder.DropTable( - name: "TblAuthorTblSC5FilePack"); - - _ = migrationBuilder.DropTable( - name: "TblObjectPackTblTag"); - - _ = migrationBuilder.DropTable( - name: "TblObjectTblObjectPack"); - - _ = migrationBuilder.DropTable( - name: "TblObjectTblTag"); - - _ = migrationBuilder.DropTable( - name: "TblSC5FilePackTblTag"); - - _ = migrationBuilder.DropTable( - name: "TblSC5FileTblSC5FilePack"); - - _ = migrationBuilder.DropTable( - name: "TblSC5FileTblTag"); - - _ = migrationBuilder.DropTable( - name: "Authors"); - - _ = migrationBuilder.DropTable( - name: "ObjectPacks"); - - _ = migrationBuilder.DropTable( - name: "Objects"); - - _ = migrationBuilder.DropTable( - name: "SC5FilePacks"); - - _ = migrationBuilder.DropTable( - name: "SC5Files"); - - _ = migrationBuilder.DropTable( - name: "Tags"); - - _ = migrationBuilder.DropTable( - name: "Licences"); - } -} diff --git a/Definitions/Migrations/20250602004808_AddObjectLookup.Designer.cs b/Definitions/Migrations/20250602004808_AddObjectLookup.Designer.cs deleted file mode 100644 index 0c357ecc..00000000 --- a/Definitions/Migrations/20250602004808_AddObjectLookup.Designer.cs +++ /dev/null @@ -1,630 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250602004808_AddObjectLookup")] - partial class AddObjectLookup - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.3"); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLookupFromDat", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("ObjectDatLookups"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLookupFromDat", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany() - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250602004808_AddObjectLookup.cs b/Definitions/Migrations/20250602004808_AddObjectLookup.cs deleted file mode 100644 index fce00fea..00000000 --- a/Definitions/Migrations/20250602004808_AddObjectLookup.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class AddObjectLookup : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropColumn( - name: "Availability", - table: "Objects"); - - _ = migrationBuilder.CreateTable( - name: "ObjectDatLookups", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DatName = table.Column(type: "TEXT", nullable: false), - DatChecksum = table.Column(type: "INTEGER", nullable: false), - xxHash3 = table.Column(type: "INTEGER", nullable: false), - ObjectId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjectDatLookups", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjectDatLookups_Objects_ObjectId", - column: x => x.ObjectId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectDatLookups_DatName_DatChecksum", - table: "ObjectDatLookups", - columns: ["DatName", "DatChecksum"], - unique: true, - descending: [true, false]); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectDatLookups_ObjectId", - table: "ObjectDatLookups", - column: "ObjectId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectDatLookups_xxHash3", - table: "ObjectDatLookups", - column: "xxHash3", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropTable( - name: "ObjectDatLookups"); - - _ = migrationBuilder.AddColumn( - name: "Availability", - table: "Objects", - type: "INTEGER", - nullable: false, - defaultValue: 0); - } -} diff --git a/Definitions/Migrations/20250603100806_AddStringTable.Designer.cs b/Definitions/Migrations/20250603100806_AddStringTable.Designer.cs deleted file mode 100644 index 51f34d0c..00000000 --- a/Definitions/Migrations/20250603100806_AddStringTable.Designer.cs +++ /dev/null @@ -1,668 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250603100806_AddStringTable")] - partial class AddStringTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("StringIndex") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("TblStringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250603100806_AddStringTable.cs b/Definitions/Migrations/20250603100806_AddStringTable.cs deleted file mode 100644 index 44e939c9..00000000 --- a/Definitions/Migrations/20250603100806_AddStringTable.cs +++ /dev/null @@ -1,181 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class AddStringTable : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropTable( - name: "ObjectDatLookups"); - - _ = migrationBuilder.DropIndex( - name: "IX_Objects_DatName_DatChecksum", - table: "Objects"); - - _ = migrationBuilder.DropColumn( - name: "DatChecksum", - table: "Objects"); - - _ = migrationBuilder.DropColumn( - name: "DatName", - table: "Objects"); - - _ = migrationBuilder.CreateTable( - name: "DatObjects", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DatName = table.Column(type: "TEXT", nullable: false), - DatChecksum = table.Column(type: "INTEGER", nullable: false), - xxHash3 = table.Column(type: "INTEGER", nullable: false), - ObjectId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_DatObjects", x => x.Id); - _ = table.ForeignKey( - name: "FK_DatObjects_Objects_ObjectId", - column: x => x.ObjectId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "TblStringTable", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - StringIndex = table.Column(type: "INTEGER", nullable: false), - Language = table.Column(type: "INTEGER", nullable: false), - Text = table.Column(type: "TEXT", nullable: false), - ObjectId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_TblStringTable", x => x.Id); - _ = table.ForeignKey( - name: "FK_TblStringTable_Objects_ObjectId", - column: x => x.ObjectId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateIndex( - name: "IX_Authors_Name", - table: "Authors", - column: "Name", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_DatObjects_DatName_DatChecksum", - table: "DatObjects", - columns: ["DatName", "DatChecksum"], - unique: true, - descending: [true, false]); - - _ = migrationBuilder.CreateIndex( - name: "IX_DatObjects_ObjectId", - table: "DatObjects", - column: "ObjectId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_DatObjects_xxHash3", - table: "DatObjects", - column: "xxHash3", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblStringTable_ObjectId", - table: "TblStringTable", - column: "ObjectId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_TblStringTable_Text", - table: "TblStringTable", - column: "Text"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropTable( - name: "DatObjects"); - - _ = migrationBuilder.DropTable( - name: "TblStringTable"); - - _ = migrationBuilder.DropIndex( - name: "IX_Authors_Name", - table: "Authors"); - - _ = migrationBuilder.AddColumn( - name: "DatChecksum", - table: "Objects", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "DatName", - table: "Objects", - type: "TEXT", - nullable: false, - defaultValue: ""); - - _ = migrationBuilder.CreateTable( - name: "ObjectDatLookups", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ObjectId = table.Column(type: "INTEGER", nullable: false), - DatChecksum = table.Column(type: "INTEGER", nullable: false), - DatName = table.Column(type: "TEXT", nullable: false), - xxHash3 = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjectDatLookups", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjectDatLookups_Objects_ObjectId", - column: x => x.ObjectId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateIndex( - name: "IX_Objects_DatName_DatChecksum", - table: "Objects", - columns: ["DatName", "DatChecksum"], - unique: true, - descending: [true, false]); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectDatLookups_DatName_DatChecksum", - table: "ObjectDatLookups", - columns: ["DatName", "DatChecksum"], - unique: true, - descending: [true, false]); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectDatLookups_ObjectId", - table: "ObjectDatLookups", - column: "ObjectId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectDatLookups_xxHash3", - table: "ObjectDatLookups", - column: "xxHash3", - unique: true); - } -} diff --git a/Definitions/Migrations/20250603102909_StringTableRowName.Designer.cs b/Definitions/Migrations/20250603102909_StringTableRowName.Designer.cs deleted file mode 100644 index cc1a216e..00000000 --- a/Definitions/Migrations/20250603102909_StringTableRowName.Designer.cs +++ /dev/null @@ -1,668 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250603102909_StringTableRowName")] - partial class StringTableRowName - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("StringIndex") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("TblStringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250603102909_StringTableRowName.cs b/Definitions/Migrations/20250603102909_StringTableRowName.cs deleted file mode 100644 index fcf1c6e1..00000000 --- a/Definitions/Migrations/20250603102909_StringTableRowName.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class StringTableRowName : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } -} diff --git a/Definitions/Migrations/20250603103118_StringTableRowName2.Designer.cs b/Definitions/Migrations/20250603103118_StringTableRowName2.Designer.cs deleted file mode 100644 index 37069c8f..00000000 --- a/Definitions/Migrations/20250603103118_StringTableRowName2.Designer.cs +++ /dev/null @@ -1,669 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250603103118_StringTableRowName2")] - partial class StringTableRowName2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("RowLanguage") - .HasColumnType("INTEGER"); - - b.Property("RowName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RowText") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("RowText"); - - b.ToTable("TblStringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250603103118_StringTableRowName2.cs b/Definitions/Migrations/20250603103118_StringTableRowName2.cs deleted file mode 100644 index 9dc5b734..00000000 --- a/Definitions/Migrations/20250603103118_StringTableRowName2.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class StringTableRowName2 : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropColumn( - name: "Language", - table: "TblStringTable"); - - _ = migrationBuilder.RenameColumn( - name: "Text", - table: "TblStringTable", - newName: "RowText"); - - _ = migrationBuilder.RenameColumn( - name: "Language", - table: "TblStringTable", - newName: "RowLanguage"); - - _ = migrationBuilder.RenameIndex( - name: "IX_TblStringTable_Text", - table: "TblStringTable", - newName: "IX_TblStringTable_RowText"); - - _ = migrationBuilder.AddColumn( - name: "RowName", - table: "TblStringTable", - type: "TEXT", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropColumn( - name: "RowName", - table: "TblStringTable"); - - _ = migrationBuilder.RenameColumn( - name: "RowText", - table: "TblStringTable", - newName: "Text"); - - _ = migrationBuilder.RenameColumn( - name: "RowLanguage", - table: "TblStringTable", - newName: "Language"); - - _ = migrationBuilder.RenameIndex( - name: "IX_TblStringTable_RowText", - table: "TblStringTable", - newName: "IX_TblStringTable_Text"); - - _ = migrationBuilder.AddColumn( - name: "StringIndex", - table: "TblStringTable", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - } -} diff --git a/Definitions/Migrations/20250615084605_AddIdentity.Designer.cs b/Definitions/Migrations/20250615084605_AddIdentity.Designer.cs deleted file mode 100644 index 4cbaaa22..00000000 --- a/Definitions/Migrations/20250615084605_AddIdentity.Designer.cs +++ /dev/null @@ -1,911 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250615084605_AddIdentity")] - partial class AddIdentity - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.LocoRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.LocoUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("RowLanguage") - .HasColumnType("INTEGER"); - - b.Property("RowName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RowText") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("RowText"); - - b.ToTable("TblStringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.LocoRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.LocoUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.LocoUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.LocoRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.LocoUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.LocoUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250615084605_AddIdentity.cs b/Definitions/Migrations/20250615084605_AddIdentity.cs deleted file mode 100644 index 2d95ab6f..00000000 --- a/Definitions/Migrations/20250615084605_AddIdentity.cs +++ /dev/null @@ -1,220 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class AddIdentity : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - _ = migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(type: "TEXT", nullable: false), - UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - _ = migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoleId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - _ = table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - _ = table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "TEXT", nullable: false), - ProviderKey = table.Column(type: "TEXT", nullable: false), - ProviderDisplayName = table.Column(type: "TEXT", nullable: true), - UserId = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - _ = table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "TEXT", nullable: false), - RoleId = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - _ = table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - _ = table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "TEXT", nullable: false), - LoginProvider = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - _ = table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - _ = migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - _ = migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - _ = migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - _ = migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - _ = migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - _ = migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - _ = migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - _ = migrationBuilder.DropTable( - name: "AspNetRoles"); - - _ = migrationBuilder.DropTable( - name: "AspNetUsers"); - } -} diff --git a/Definitions/Migrations/20250616030006_RenameStringTable.Designer.cs b/Definitions/Migrations/20250616030006_RenameStringTable.Designer.cs deleted file mode 100644 index 5f43dc9a..00000000 --- a/Definitions/Migrations/20250616030006_RenameStringTable.Designer.cs +++ /dev/null @@ -1,938 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250616030006_RenameStringTable")] - partial class RenameStringTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("RowLanguage") - .HasColumnType("INTEGER"); - - b.Property("RowName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RowText") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("RowText"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("GuidId") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250616030006_RenameStringTable.cs b/Definitions/Migrations/20250616030006_RenameStringTable.cs deleted file mode 100644 index d5376d3b..00000000 --- a/Definitions/Migrations/20250616030006_RenameStringTable.cs +++ /dev/null @@ -1,87 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class RenameStringTable : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_TblStringTable_Objects_ObjectId", - table: "TblStringTable"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_TblStringTable", - table: "TblStringTable"); - - _ = migrationBuilder.RenameTable( - name: "TblStringTable", - newName: "StringTable"); - - _ = migrationBuilder.RenameIndex( - name: "IX_TblStringTable_RowText", - table: "StringTable", - newName: "IX_StringTable_RowText"); - - _ = migrationBuilder.RenameIndex( - name: "IX_TblStringTable_ObjectId", - table: "StringTable", - newName: "IX_StringTable_ObjectId"); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_StringTable", - table: "StringTable", - column: "Id"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_StringTable_Objects_ObjectId", - table: "StringTable", - column: "ObjectId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_StringTable_Objects_ObjectId", - table: "StringTable"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_StringTable", - table: "StringTable"); - - _ = migrationBuilder.RenameTable( - name: "StringTable", - newName: "TblStringTable"); - - _ = migrationBuilder.RenameIndex( - name: "IX_StringTable_RowText", - table: "TblStringTable", - newName: "IX_TblStringTable_RowText"); - - _ = migrationBuilder.RenameIndex( - name: "IX_StringTable_ObjectId", - table: "TblStringTable", - newName: "IX_TblStringTable_ObjectId"); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_TblStringTable", - table: "TblStringTable", - column: "Id"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblStringTable_Objects_ObjectId", - table: "TblStringTable", - column: "ObjectId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } -} diff --git a/Definitions/Migrations/20250617071719_intTolong.Designer.cs b/Definitions/Migrations/20250617071719_intTolong.Designer.cs deleted file mode 100644 index 640b54d9..00000000 --- a/Definitions/Migrations/20250617071719_intTolong.Designer.cs +++ /dev/null @@ -1,911 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250617071719_intTolong")] - partial class intTolong - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("TEXT"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("TEXT"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("RowLanguage") - .HasColumnType("INTEGER"); - - b.Property("RowName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RowText") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("RowText"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("TEXT"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250617071719_intTolong.cs b/Definitions/Migrations/20250617071719_intTolong.cs deleted file mode 100644 index bdb4edfa..00000000 --- a/Definitions/Migrations/20250617071719_intTolong.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class intTolong : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "Tags"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "StringTable"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "SC5Files"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "SC5FilePacks"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "Objects"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "ObjectPacks"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "Licences"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "DatObjects"); - - _ = migrationBuilder.DropColumn( - name: "GuidId", - table: "Authors"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "Tags", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "StringTable", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "SC5Files", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "SC5FilePacks", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "Objects", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "ObjectPacks", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "Licences", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "DatObjects", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - - _ = migrationBuilder.AddColumn( - name: "GuidId", - table: "Authors", - type: "TEXT", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - } -} diff --git a/Definitions/Migrations/20250617081552_LinkUserToAuthor.Designer.cs b/Definitions/Migrations/20250617081552_LinkUserToAuthor.Designer.cs deleted file mode 100644 index db304e3b..00000000 --- a/Definitions/Migrations/20250617081552_LinkUserToAuthor.Designer.cs +++ /dev/null @@ -1,936 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250617081552_LinkUserToAuthor")] - partial class LinkUserToAuthor - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Definitions.Database.Identity.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId") - .IsUnique(); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.Identity.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("RowLanguage") - .HasColumnType("INTEGER"); - - b.Property("RowName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RowText") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("RowText"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.Identity.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithOne("AssociatedUser") - .HasForeignKey("Definitions.Database.Identity.TblUser", "AssociatedAuthorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.Identity.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.Identity.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Navigation("AssociatedUser"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250617081552_LinkUserToAuthor.cs b/Definitions/Migrations/20250617081552_LinkUserToAuthor.cs deleted file mode 100644 index 7d894dab..00000000 --- a/Definitions/Migrations/20250617081552_LinkUserToAuthor.cs +++ /dev/null @@ -1,193 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class LinkUserToAuthor : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.AddColumn( - name: "AssociatedAuthorId", - table: "Authors", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserTokens", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT"); - - _ = migrationBuilder.AlterColumn( - name: "Id", - table: "AspNetUsers", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT") - .Annotation("Sqlite:Autoincrement", true); - - _ = migrationBuilder.AddColumn( - name: "AssociatedAuthorId", - table: "AspNetUsers", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AlterColumn( - name: "RoleId", - table: "AspNetUserRoles", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT"); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserRoles", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT"); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserLogins", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT"); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserClaims", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT"); - - _ = migrationBuilder.AlterColumn( - name: "Id", - table: "AspNetRoles", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT") - .Annotation("Sqlite:Autoincrement", true); - - _ = migrationBuilder.AlterColumn( - name: "RoleId", - table: "AspNetRoleClaims", - type: "INTEGER", - nullable: false, - oldClrType: typeof(Guid), - oldType: "TEXT"); - - _ = migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_AssociatedAuthorId", - table: "AspNetUsers", - column: "AssociatedAuthorId", - unique: true); - - _ = migrationBuilder.AddForeignKey( - name: "FK_AspNetUsers_Authors_AssociatedAuthorId", - table: "AspNetUsers", - column: "AssociatedAuthorId", - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_AspNetUsers_Authors_AssociatedAuthorId", - table: "AspNetUsers"); - - _ = migrationBuilder.DropIndex( - name: "IX_AspNetUsers_AssociatedAuthorId", - table: "AspNetUsers"); - - _ = migrationBuilder.DropColumn( - name: "AssociatedAuthorId", - table: "Authors"); - - _ = migrationBuilder.DropColumn( - name: "AssociatedAuthorId", - table: "AspNetUsers"); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserTokens", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER"); - - _ = migrationBuilder.AlterColumn( - name: "Id", - table: "AspNetUsers", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER") - .OldAnnotation("Sqlite:Autoincrement", true); - - _ = migrationBuilder.AlterColumn( - name: "RoleId", - table: "AspNetUserRoles", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER"); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserRoles", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER"); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserLogins", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER"); - - _ = migrationBuilder.AlterColumn( - name: "UserId", - table: "AspNetUserClaims", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER"); - - _ = migrationBuilder.AlterColumn( - name: "Id", - table: "AspNetRoles", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER") - .OldAnnotation("Sqlite:Autoincrement", true); - - _ = migrationBuilder.AlterColumn( - name: "RoleId", - table: "AspNetRoleClaims", - type: "TEXT", - nullable: false, - oldClrType: typeof(ulong), - oldType: "INTEGER"); - } -} diff --git a/Definitions/Migrations/20250617085044_LinkUserToAuthor2.Designer.cs b/Definitions/Migrations/20250617085044_LinkUserToAuthor2.Designer.cs deleted file mode 100644 index 17f14bd6..00000000 --- a/Definitions/Migrations/20250617085044_LinkUserToAuthor2.Designer.cs +++ /dev/null @@ -1,925 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250617085044_LinkUserToAuthor2")] - partial class LinkUserToAuthor2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.5"); - - modelBuilder.Entity("Definitions.Database.Identity.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.Identity.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("RowLanguage") - .HasColumnType("INTEGER"); - - b.Property("RowName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RowText") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("RowText"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.Identity.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.Identity.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.Identity.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.Identity.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250617085044_LinkUserToAuthor2.cs b/Definitions/Migrations/20250617085044_LinkUserToAuthor2.cs deleted file mode 100644 index 1511f15f..00000000 --- a/Definitions/Migrations/20250617085044_LinkUserToAuthor2.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class LinkUserToAuthor2 : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - //migrationBuilder.DropForeignKey( - // name: "FK_AspNetUsers_Authors_AssociatedAuthorId", - // table: "AspNetUsers"); - - //migrationBuilder.DropIndex( - // name: "IX_AspNetUsers_AssociatedAuthorId", - // table: "AspNetUsers"); - - //_ = migrationBuilder.DropColumn( - // name: "AssociatedAuthorId", - // table: "Authors"); - - //migrationBuilder.AlterColumn( - // name: "AssociatedAuthorId", - // table: "AspNetUsers", - // type: "INTEGER", - // nullable: true, - // oldClrType: typeof(ulong), - // oldType: "INTEGER"); - - //migrationBuilder.CreateIndex( - // name: "IX_AspNetUsers_AssociatedAuthorId", - // table: "AspNetUsers", - // column: "AssociatedAuthorId"); - - //migrationBuilder.AddForeignKey( - // name: "FK_AspNetUsers_Authors_AssociatedAuthorId", - // table: "AspNetUsers", - // column: "AssociatedAuthorId", - // principalTable: "Authors", - // principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_AspNetUsers_Authors_AssociatedAuthorId", - table: "AspNetUsers"); - - _ = migrationBuilder.DropIndex( - name: "IX_AspNetUsers_AssociatedAuthorId", - table: "AspNetUsers"); - - _ = migrationBuilder.AddColumn( - name: "AssociatedAuthorId", - table: "Authors", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AlterColumn( - name: "AssociatedAuthorId", - table: "AspNetUsers", - type: "INTEGER", - nullable: false, - defaultValue: 0ul, - oldClrType: typeof(ulong), - oldType: "INTEGER", - oldNullable: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_AspNetUsers_AssociatedAuthorId", - table: "AspNetUsers", - column: "AssociatedAuthorId", - unique: true); - - _ = migrationBuilder.AddForeignKey( - name: "FK_AspNetUsers_Authors_AssociatedAuthorId", - table: "AspNetUsers", - column: "AssociatedAuthorId", - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } -} diff --git a/Definitions/Migrations/20250627061229_ReaddAvailability.Designer.cs b/Definitions/Migrations/20250627061229_ReaddAvailability.Designer.cs deleted file mode 100644 index 9df4afa6..00000000 --- a/Definitions/Migrations/20250627061229_ReaddAvailability.Designer.cs +++ /dev/null @@ -1,928 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250627061229_ReaddAvailability")] - partial class ReaddAvailability - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("RowLanguage") - .HasColumnType("INTEGER"); - - b.Property("RowName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("RowText") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("RowText"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTable", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250627061229_ReaddAvailability.cs b/Definitions/Migrations/20250627061229_ReaddAvailability.cs deleted file mode 100644 index 41e2c8ed..00000000 --- a/Definitions/Migrations/20250627061229_ReaddAvailability.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class ReaddAvailability : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) => migrationBuilder.AddColumn( - name: "Availability", - table: "Objects", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - /// - protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropColumn( - name: "Availability", - table: "Objects"); -} diff --git a/Definitions/Migrations/20250630032403_SubObjectTables.Designer.cs b/Definitions/Migrations/20250630032403_SubObjectTables.Designer.cs deleted file mode 100644 index 308f96ec..00000000 --- a/Definitions/Migrations/20250630032403_SubObjectTables.Designer.cs +++ /dev/null @@ -1,1819 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250630032403_SubObjectTables")] - partial class SubObjectTables - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjHeader"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjAirport"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBridge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBuilding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCargo"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCliffEdge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjClimate"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCompetitor"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCurrency"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjDock"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjHillShapes"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjIndustry"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjInterface"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLand"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLevelCrossing"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRegion"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoad"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScaffolding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScenarioText"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSnow"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSound"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSteam"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjStreetLight"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTownNames"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrack"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackSignal"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTree"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTunnel"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWall"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWater"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250630032403_SubObjectTables.cs b/Definitions/Migrations/20250630032403_SubObjectTables.cs deleted file mode 100644 index 35f3a90d..00000000 --- a/Definitions/Migrations/20250630032403_SubObjectTables.cs +++ /dev/null @@ -1,1136 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class SubObjectTables : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_DatObjects_Objects_ObjectId", - table: "DatObjects"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_Objects_Licences_LicenceId", - table: "Objects"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_StringTable_Objects_ObjectId", - table: "StringTable"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblAuthorTblObject_Objects_ObjectsId", - table: "TblAuthorTblObject"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", - table: "TblObjectTblObjectPack"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblTag_Objects_ObjectsId", - table: "TblObjectTblTag"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_Objects", - table: "Objects"); - - _ = migrationBuilder.RenameTable( - name: "Objects", - newName: "ObjHeader"); - - _ = migrationBuilder.RenameColumn( - name: "RowText", - table: "StringTable", - newName: "Text"); - - _ = migrationBuilder.RenameColumn( - name: "RowName", - table: "StringTable", - newName: "Name"); - - _ = migrationBuilder.RenameColumn( - name: "RowLanguage", - table: "StringTable", - newName: "Language"); - - _ = migrationBuilder.RenameIndex( - name: "IX_StringTable_RowText", - table: "StringTable", - newName: "IX_StringTable_Text"); - - _ = migrationBuilder.RenameIndex( - name: "IX_Objects_Name", - table: "ObjHeader", - newName: "IX_ObjHeader_Name"); - - _ = migrationBuilder.RenameIndex( - name: "IX_Objects_LicenceId", - table: "ObjHeader", - newName: "IX_ObjHeader_LicenceId"); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_ObjHeader", - table: "ObjHeader", - column: "Id"); - - _ = migrationBuilder.CreateTable( - name: "ObjAirport", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjAirport", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjAirport_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjBridge", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjBridge", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjBridge_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjBuilding", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjBuilding", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjBuilding_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCargo", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCargo", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCargo_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCliffEdge", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCliffEdge", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCliffEdge_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjClimate", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjClimate", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjClimate_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCompetitor", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCompetitor", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCompetitor_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCurrency", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCurrency", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCurrency_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjDock", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjDock", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjDock_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjHillShapes", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjHillShapes", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjHillShapes_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjIndustry", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjIndustry", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjIndustry_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjInterface", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjInterface", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjInterface_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjLand", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjLand", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjLand_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjLevelCrossing", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjLevelCrossing", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjLevelCrossing_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRegion", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRegion", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRegion_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRoad", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRoad", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRoad_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRoadExtra", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRoadExtra", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRoadExtra_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRoadStation", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRoadStation", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRoadStation_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjScaffolding", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjScaffolding", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjScaffolding_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjScenarioText", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjScenarioText", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjScenarioText_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjSnow", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjSnow", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjSnow_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjSound", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjSound", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjSound_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjSteam", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjSteam", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjSteam_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjStreetLight", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjStreetLight", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjStreetLight_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTownNames", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTownNames", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTownNames_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrack", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrack", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrack_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrackExtra", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrackExtra", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrackExtra_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrackSignal", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrackSignal", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrackSignal_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrackStation", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrackStation", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrackStation_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTree", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTree", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTree_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTunnel", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTunnel", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTunnel_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjWall", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjWall", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjWall_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjWater", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjWater", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjWater_ObjHeader_ParentId", - column: x => x.ParentId, - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjAirport_ParentId", - table: "ObjAirport", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjBridge_ParentId", - table: "ObjBridge", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjBuilding_ParentId", - table: "ObjBuilding", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCargo_ParentId", - table: "ObjCargo", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCliffEdge_ParentId", - table: "ObjCliffEdge", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjClimate_ParentId", - table: "ObjClimate", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCompetitor_ParentId", - table: "ObjCompetitor", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCurrency_ParentId", - table: "ObjCurrency", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjDock_ParentId", - table: "ObjDock", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjHillShapes_ParentId", - table: "ObjHillShapes", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjIndustry_ParentId", - table: "ObjIndustry", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjInterface_ParentId", - table: "ObjInterface", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjLand_ParentId", - table: "ObjLand", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjLevelCrossing_ParentId", - table: "ObjLevelCrossing", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRegion_ParentId", - table: "ObjRegion", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoad_ParentId", - table: "ObjRoad", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoadExtra_ParentId", - table: "ObjRoadExtra", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoadStation_ParentId", - table: "ObjRoadStation", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjScaffolding_ParentId", - table: "ObjScaffolding", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjScenarioText_ParentId", - table: "ObjScenarioText", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSnow_ParentId", - table: "ObjSnow", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSound_ParentId", - table: "ObjSound", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSteam_ParentId", - table: "ObjSteam", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjStreetLight_ParentId", - table: "ObjStreetLight", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTownNames_ParentId", - table: "ObjTownNames", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrack_ParentId", - table: "ObjTrack", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackExtra_ParentId", - table: "ObjTrackExtra", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackSignal_ParentId", - table: "ObjTrackSignal", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackStation_ParentId", - table: "ObjTrackStation", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTree_ParentId", - table: "ObjTree", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTunnel_ParentId", - table: "ObjTunnel", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjWall_ParentId", - table: "ObjWall", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjWater_ParentId", - table: "ObjWater", - column: "ParentId"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_DatObjects_ObjHeader_ObjectId", - table: "DatObjects", - column: "ObjectId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjHeader_Licences_LicenceId", - table: "ObjHeader", - column: "LicenceId", - principalTable: "Licences", - principalColumn: "Id"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_StringTable_ObjHeader_ObjectId", - table: "StringTable", - column: "ObjectId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblAuthorTblObject_ObjHeader_ObjectsId", - table: "TblAuthorTblObject", - column: "ObjectsId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblObjectPack_ObjHeader_ObjectsId", - table: "TblObjectTblObjectPack", - column: "ObjectsId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblTag_ObjHeader_ObjectsId", - table: "TblObjectTblTag", - column: "ObjectsId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_DatObjects_ObjHeader_ObjectId", - table: "DatObjects"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjHeader_Licences_LicenceId", - table: "ObjHeader"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_StringTable_ObjHeader_ObjectId", - table: "StringTable"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblAuthorTblObject_ObjHeader_ObjectsId", - table: "TblAuthorTblObject"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblObjectPack_ObjHeader_ObjectsId", - table: "TblObjectTblObjectPack"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblTag_ObjHeader_ObjectsId", - table: "TblObjectTblTag"); - - _ = migrationBuilder.DropTable( - name: "ObjAirport"); - - _ = migrationBuilder.DropTable( - name: "ObjBridge"); - - _ = migrationBuilder.DropTable( - name: "ObjBuilding"); - - _ = migrationBuilder.DropTable( - name: "ObjCargo"); - - _ = migrationBuilder.DropTable( - name: "ObjCliffEdge"); - - _ = migrationBuilder.DropTable( - name: "ObjClimate"); - - _ = migrationBuilder.DropTable( - name: "ObjCompetitor"); - - _ = migrationBuilder.DropTable( - name: "ObjCurrency"); - - _ = migrationBuilder.DropTable( - name: "ObjDock"); - - _ = migrationBuilder.DropTable( - name: "ObjHillShapes"); - - _ = migrationBuilder.DropTable( - name: "ObjIndustry"); - - _ = migrationBuilder.DropTable( - name: "ObjInterface"); - - _ = migrationBuilder.DropTable( - name: "ObjLand"); - - _ = migrationBuilder.DropTable( - name: "ObjLevelCrossing"); - - _ = migrationBuilder.DropTable( - name: "ObjRegion"); - - _ = migrationBuilder.DropTable( - name: "ObjRoad"); - - _ = migrationBuilder.DropTable( - name: "ObjRoadExtra"); - - _ = migrationBuilder.DropTable( - name: "ObjRoadStation"); - - _ = migrationBuilder.DropTable( - name: "ObjScaffolding"); - - _ = migrationBuilder.DropTable( - name: "ObjScenarioText"); - - _ = migrationBuilder.DropTable( - name: "ObjSnow"); - - _ = migrationBuilder.DropTable( - name: "ObjSound"); - - _ = migrationBuilder.DropTable( - name: "ObjSteam"); - - _ = migrationBuilder.DropTable( - name: "ObjStreetLight"); - - _ = migrationBuilder.DropTable( - name: "ObjTownNames"); - - _ = migrationBuilder.DropTable( - name: "ObjTrack"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackExtra"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackSignal"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackStation"); - - _ = migrationBuilder.DropTable( - name: "ObjTree"); - - _ = migrationBuilder.DropTable( - name: "ObjTunnel"); - - _ = migrationBuilder.DropTable( - name: "ObjWall"); - - _ = migrationBuilder.DropTable( - name: "ObjWater"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_ObjHeader", - table: "ObjHeader"); - - _ = migrationBuilder.RenameTable( - name: "ObjHeader", - newName: "Objects"); - - _ = migrationBuilder.RenameColumn( - name: "Text", - table: "StringTable", - newName: "RowText"); - - _ = migrationBuilder.RenameColumn( - name: "Name", - table: "StringTable", - newName: "RowName"); - - _ = migrationBuilder.RenameColumn( - name: "Language", - table: "StringTable", - newName: "RowLanguage"); - - _ = migrationBuilder.RenameIndex( - name: "IX_StringTable_Text", - table: "StringTable", - newName: "IX_StringTable_RowText"); - - _ = migrationBuilder.RenameIndex( - name: "IX_ObjHeader_Name", - table: "Objects", - newName: "IX_Objects_Name"); - - _ = migrationBuilder.RenameIndex( - name: "IX_ObjHeader_LicenceId", - table: "Objects", - newName: "IX_Objects_LicenceId"); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_Objects", - table: "Objects", - column: "Id"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_DatObjects_Objects_ObjectId", - table: "DatObjects", - column: "ObjectId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_Objects_Licences_LicenceId", - table: "Objects", - column: "LicenceId", - principalTable: "Licences", - principalColumn: "Id"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_StringTable_Objects_ObjectId", - table: "StringTable", - column: "ObjectId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblAuthorTblObject_Objects_ObjectsId", - table: "TblAuthorTblObject", - column: "ObjectsId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", - table: "TblObjectTblObjectPack", - column: "ObjectsId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblTag_Objects_ObjectsId", - table: "TblObjectTblTag", - column: "ObjectsId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } -} diff --git a/Definitions/Migrations/20250630043418_SubObjectTPT.Designer.cs b/Definitions/Migrations/20250630043418_SubObjectTPT.Designer.cs deleted file mode 100644 index 50df2605..00000000 --- a/Definitions/Migrations/20250630043418_SubObjectTPT.Designer.cs +++ /dev/null @@ -1,1474 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250630043418_SubObjectTPT")] - partial class SubObjectTPT - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjAirport"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjBridge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjBuilding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjCargo"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjCliffEdge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjClimate"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjCompetitor"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjCurrency"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjDock"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjHillShapes"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjIndustry"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjInterface"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjLand"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjLevelCrossing"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjRegion"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjRoad"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjRoadExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjRoadStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjScaffolding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjScenarioText"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjSnow"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjSound"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjSteam"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjStreetLight"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjTownNames"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjTrack"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjTrackExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjTrackSignal"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjTrackStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjTree"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjTunnel"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjVehicle"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjWall"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasBaseType("Definitions.Database.TblObject"); - - b.ToTable("ObjWater"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectAirport", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectBridge", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectBuilding", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectCargo", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectCliffEdge", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectClimate", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectCompetitor", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectCurrency", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectDock", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectHillShapes", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectIndustry", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectInterface", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectLand", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectLevelCrossing", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectRegion", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectRoad", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectRoadExtra", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectRoadStation", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectScaffolding", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectScenarioText", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectSnow", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectSound", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectSteam", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectStreetLight", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectTownNames", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectTrack", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectTrackExtra", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectTrackSignal", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectTrackStation", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectTree", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectTunnel", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectVehicle", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectWall", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithOne() - .HasForeignKey("Definitions.Database.TblObjectWater", "Id") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250630043418_SubObjectTPT.cs b/Definitions/Migrations/20250630043418_SubObjectTPT.cs deleted file mode 100644 index 9d3dca5d..00000000 --- a/Definitions/Migrations/20250630043418_SubObjectTPT.cs +++ /dev/null @@ -1,999 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class SubObjectTPT : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_DatObjects_ObjHeader_ObjectId", - table: "DatObjects"); - - //migrationBuilder.DropForeignKey( - // name: "FK_ObjHeader_DbSubObject_SubObjectId", - // table: "ObjHeader"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjHeader_Licences_LicenceId", - table: "ObjHeader"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_StringTable_ObjHeader_ObjectId", - table: "StringTable"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblAuthorTblObject_ObjHeader_ObjectsId", - table: "TblAuthorTblObject"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblObjectPack_ObjHeader_ObjectsId", - table: "TblObjectTblObjectPack"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblTag_ObjHeader_ObjectsId", - table: "TblObjectTblTag"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_ObjHeader", - table: "ObjHeader"); - - //_ = migrationBuilder.DropIndex( - // name: "IX_ObjHeader_SubObjectId", - // table: "ObjHeader"); - - //_ = migrationBuilder.DropPrimaryKey( - // name: "PK_DbSubObject", - // table: "DbSubObject"); - - _ = migrationBuilder.DropColumn( - name: "SubObjectId", - table: "ObjHeader"); - - //_ = migrationBuilder.DropColumn( - // name: "Discriminator", - // table: "DbSubObject"); - - _ = migrationBuilder.RenameTable( - name: "ObjHeader", - newName: "Objects"); - - //_ = migrationBuilder.RenameTable( - // name: "DbSubObject", - // newName: "ObjWater"); - - _ = migrationBuilder.RenameIndex( - name: "IX_ObjHeader_Name", - table: "Objects", - newName: "IX_Objects_Name"); - - _ = migrationBuilder.RenameIndex( - name: "IX_ObjHeader_LicenceId", - table: "Objects", - newName: "IX_Objects_LicenceId"); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_Objects", - table: "Objects", - column: "Id"); - - //_ = migrationBuilder.AddPrimaryKey( - // name: "PK_ObjWater", - // table: "ObjWater", - // column: "Id"); - - _ = migrationBuilder.CreateTable( - name: "ObjAirport", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjAirport", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjAirport_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjBridge", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjBridge", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjBridge_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjBuilding", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjBuilding", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjBuilding_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCargo", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCargo", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCargo_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCliffEdge", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCliffEdge", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCliffEdge_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjClimate", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjClimate", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjClimate_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCompetitor", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCompetitor", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCompetitor_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjCurrency", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjCurrency", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjCurrency_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjDock", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjDock", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjDock_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjHillShapes", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjHillShapes", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjHillShapes_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjIndustry", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjIndustry", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjIndustry_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjInterface", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjInterface", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjInterface_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjLand", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjLand", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjLand_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjLevelCrossing", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjLevelCrossing", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjLevelCrossing_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRegion", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRegion", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRegion_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRoad", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRoad", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRoad_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRoadExtra", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRoadExtra", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRoadExtra_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjRoadStation", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjRoadStation", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjRoadStation_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjScaffolding", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjScaffolding", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjScaffolding_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjScenarioText", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjScenarioText", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjScenarioText_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjSnow", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjSnow", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjSnow_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjSound", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjSound", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjSound_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjSteam", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjSteam", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjSteam_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjStreetLight", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjStreetLight", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjStreetLight_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTownNames", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTownNames", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTownNames_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrack", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrack", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrack_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrackExtra", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrackExtra", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrackExtra_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrackSignal", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrackSignal", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrackSignal_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTrackStation", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTrackStation", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTrackStation_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTree", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTree", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTree_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjTunnel", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjTunnel", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjTunnel_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjVehicle", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjVehicle", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjVehicle_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjWall", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjWall", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjWall_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.CreateTable( - name: "ObjWater", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjWater", x => x.Id); - _ = table.ForeignKey( - name: "FK_ObjWater_Objects_Id", - column: x => x.Id, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - _ = migrationBuilder.AddForeignKey( - name: "FK_DatObjects_Objects_ObjectId", - table: "DatObjects", - column: "ObjectId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_Objects_Licences_LicenceId", - table: "Objects", - column: "LicenceId", - principalTable: "Licences", - principalColumn: "Id"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjWater_Objects_Id", - table: "ObjWater", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_StringTable_Objects_ObjectId", - table: "StringTable", - column: "ObjectId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblAuthorTblObject_Objects_ObjectsId", - table: "TblAuthorTblObject", - column: "ObjectsId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", - table: "TblObjectTblObjectPack", - column: "ObjectsId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblTag_Objects_ObjectsId", - table: "TblObjectTblTag", - column: "ObjectsId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_DatObjects_Objects_ObjectId", - table: "DatObjects"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_Objects_Licences_LicenceId", - table: "Objects"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjWater_Objects_Id", - table: "ObjWater"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_StringTable_Objects_ObjectId", - table: "StringTable"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblAuthorTblObject_Objects_ObjectsId", - table: "TblAuthorTblObject"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", - table: "TblObjectTblObjectPack"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_TblObjectTblTag_Objects_ObjectsId", - table: "TblObjectTblTag"); - - _ = migrationBuilder.DropTable( - name: "ObjAirport"); - - _ = migrationBuilder.DropTable( - name: "ObjBridge"); - - _ = migrationBuilder.DropTable( - name: "ObjBuilding"); - - _ = migrationBuilder.DropTable( - name: "ObjCargo"); - - _ = migrationBuilder.DropTable( - name: "ObjCliffEdge"); - - _ = migrationBuilder.DropTable( - name: "ObjClimate"); - - _ = migrationBuilder.DropTable( - name: "ObjCompetitor"); - - _ = migrationBuilder.DropTable( - name: "ObjCurrency"); - - _ = migrationBuilder.DropTable( - name: "ObjDock"); - - _ = migrationBuilder.DropTable( - name: "ObjHillShapes"); - - _ = migrationBuilder.DropTable( - name: "ObjIndustry"); - - _ = migrationBuilder.DropTable( - name: "ObjInterface"); - - _ = migrationBuilder.DropTable( - name: "ObjLand"); - - _ = migrationBuilder.DropTable( - name: "ObjLevelCrossing"); - - _ = migrationBuilder.DropTable( - name: "ObjRegion"); - - _ = migrationBuilder.DropTable( - name: "ObjRoad"); - - _ = migrationBuilder.DropTable( - name: "ObjRoadExtra"); - - _ = migrationBuilder.DropTable( - name: "ObjRoadStation"); - - _ = migrationBuilder.DropTable( - name: "ObjScaffolding"); - - _ = migrationBuilder.DropTable( - name: "ObjScenarioText"); - - _ = migrationBuilder.DropTable( - name: "ObjSnow"); - - _ = migrationBuilder.DropTable( - name: "ObjSound"); - - _ = migrationBuilder.DropTable( - name: "ObjSteam"); - - _ = migrationBuilder.DropTable( - name: "ObjStreetLight"); - - _ = migrationBuilder.DropTable( - name: "ObjTownNames"); - - _ = migrationBuilder.DropTable( - name: "ObjTrack"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackExtra"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackSignal"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackStation"); - - _ = migrationBuilder.DropTable( - name: "ObjTree"); - - _ = migrationBuilder.DropTable( - name: "ObjTunnel"); - - _ = migrationBuilder.DropTable( - name: "ObjVehicle"); - - _ = migrationBuilder.DropTable( - name: "ObjWall"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_Objects", - table: "Objects"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_ObjWater", - table: "ObjWater"); - - _ = migrationBuilder.RenameTable( - name: "Objects", - newName: "ObjHeader"); - - _ = migrationBuilder.RenameTable( - name: "ObjWater", - newName: "DbSubObject"); - - _ = migrationBuilder.RenameIndex( - name: "IX_Objects_Name", - table: "ObjHeader", - newName: "IX_ObjHeader_Name"); - - _ = migrationBuilder.RenameIndex( - name: "IX_Objects_LicenceId", - table: "ObjHeader", - newName: "IX_ObjHeader_LicenceId"); - - _ = migrationBuilder.AddColumn( - name: "SubObjectId", - table: "ObjHeader", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "Discriminator", - table: "DbSubObject", - type: "TEXT", - maxLength: 34, - nullable: false, - defaultValue: ""); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_ObjHeader", - table: "ObjHeader", - column: "Id"); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_DbSubObject", - table: "DbSubObject", - column: "Id"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjHeader_SubObjectId", - table: "ObjHeader", - column: "SubObjectId", - unique: true); - - _ = migrationBuilder.AddForeignKey( - name: "FK_DatObjects_ObjHeader_ObjectId", - table: "DatObjects", - column: "ObjectId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjHeader_DbSubObject_SubObjectId", - table: "ObjHeader", - column: "SubObjectId", - principalTable: "DbSubObject", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjHeader_Licences_LicenceId", - table: "ObjHeader", - column: "LicenceId", - principalTable: "Licences", - principalColumn: "Id"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_StringTable_ObjHeader_ObjectId", - table: "StringTable", - column: "ObjectId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblAuthorTblObject_ObjHeader_ObjectsId", - table: "TblAuthorTblObject", - column: "ObjectsId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblObjectPack_ObjHeader_ObjectsId", - table: "TblObjectTblObjectPack", - column: "ObjectsId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_TblObjectTblTag_ObjHeader_ObjectsId", - table: "TblObjectTblTag", - column: "ObjectsId", - principalTable: "ObjHeader", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } -} diff --git a/Definitions/Migrations/20250630053103_SubObjectFK.Designer.cs b/Definitions/Migrations/20250630053103_SubObjectFK.Designer.cs deleted file mode 100644 index e301af2b..00000000 --- a/Definitions/Migrations/20250630053103_SubObjectFK.Designer.cs +++ /dev/null @@ -1,1849 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250630053103_SubObjectFK")] - partial class SubObjectFK - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("SubObjectId") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjAirport"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBridge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBuilding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCargo"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCliffEdge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjClimate"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCompetitor"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCurrency"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjDock"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjHillShapes"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjIndustry"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjInterface"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLand"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLevelCrossing"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRegion"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoad"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScaffolding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScenarioText"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSnow"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSound"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSteam"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjStreetLight"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTownNames"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrack"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackSignal"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTree"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTunnel"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjVehicle"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWall"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWater"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250630053103_SubObjectFK.cs b/Definitions/Migrations/20250630053103_SubObjectFK.cs deleted file mode 100644 index 79c4f26f..00000000 --- a/Definitions/Migrations/20250630053103_SubObjectFK.cs +++ /dev/null @@ -1,1524 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class SubObjectFK : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjAirport_Objects_Id", - table: "ObjAirport"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjBridge_Objects_Id", - table: "ObjBridge"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjBuilding_Objects_Id", - table: "ObjBuilding"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCargo_Objects_Id", - table: "ObjCargo"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCliffEdge_Objects_Id", - table: "ObjCliffEdge"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjClimate_Objects_Id", - table: "ObjClimate"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCompetitor_Objects_Id", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCurrency_Objects_Id", - table: "ObjCurrency"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjDock_Objects_Id", - table: "ObjDock"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjHillShapes_Objects_Id", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjIndustry_Objects_Id", - table: "ObjIndustry"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjInterface_Objects_Id", - table: "ObjInterface"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjLand_Objects_Id", - table: "ObjLand"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjLevelCrossing_Objects_Id", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRegion_Objects_Id", - table: "ObjRegion"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRoad_Objects_Id", - table: "ObjRoad"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRoadExtra_Objects_Id", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRoadStation_Objects_Id", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjScaffolding_Objects_Id", - table: "ObjScaffolding"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjScenarioText_Objects_Id", - table: "ObjScenarioText"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjSnow_Objects_Id", - table: "ObjSnow"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjSound_Objects_Id", - table: "ObjSound"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjSteam_Objects_Id", - table: "ObjSteam"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjStreetLight_Objects_Id", - table: "ObjStreetLight"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTownNames_Objects_Id", - table: "ObjTownNames"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrack_Objects_Id", - table: "ObjTrack"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrackExtra_Objects_Id", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrackSignal_Objects_Id", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrackStation_Objects_Id", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTree_Objects_Id", - table: "ObjTree"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTunnel_Objects_Id", - table: "ObjTunnel"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjVehicle_Objects_Id", - table: "ObjVehicle"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjWall_Objects_Id", - table: "ObjWall"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjWater_Objects_Id", - table: "ObjWater"); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjWater", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjWall", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjTunnel", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjTrackExtra", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjTownNames", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjStreetLight", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjSteam", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjSound", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjSnow", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjScenarioText", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjScaffolding", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjRoadExtra", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjRegion", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjHillShapes", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "SubObjectId", - table: "Objects", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjCurrency", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjCompetitor", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjCliffEdge", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "ParentId", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjWater_ParentId", - table: "ObjWater", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjWall_ParentId", - table: "ObjWall", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjVehicle_ParentId", - table: "ObjVehicle", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTunnel_ParentId", - table: "ObjTunnel", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTree_ParentId", - table: "ObjTree", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackStation_ParentId", - table: "ObjTrackStation", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackSignal_ParentId", - table: "ObjTrackSignal", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackExtra_ParentId", - table: "ObjTrackExtra", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrack_ParentId", - table: "ObjTrack", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTownNames_ParentId", - table: "ObjTownNames", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjStreetLight_ParentId", - table: "ObjStreetLight", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSteam_ParentId", - table: "ObjSteam", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSound_ParentId", - table: "ObjSound", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSnow_ParentId", - table: "ObjSnow", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjScenarioText_ParentId", - table: "ObjScenarioText", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjScaffolding_ParentId", - table: "ObjScaffolding", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoadStation_ParentId", - table: "ObjRoadStation", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoadExtra_ParentId", - table: "ObjRoadExtra", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoad_ParentId", - table: "ObjRoad", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRegion_ParentId", - table: "ObjRegion", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjLevelCrossing_ParentId", - table: "ObjLevelCrossing", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjLand_ParentId", - table: "ObjLand", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjInterface_ParentId", - table: "ObjInterface", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjIndustry_ParentId", - table: "ObjIndustry", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjHillShapes_ParentId", - table: "ObjHillShapes", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjDock_ParentId", - table: "ObjDock", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCurrency_ParentId", - table: "ObjCurrency", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCompetitor_ParentId", - table: "ObjCompetitor", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjClimate_ParentId", - table: "ObjClimate", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCliffEdge_ParentId", - table: "ObjCliffEdge", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCargo_ParentId", - table: "ObjCargo", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjBuilding_ParentId", - table: "ObjBuilding", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjBridge_ParentId", - table: "ObjBridge", - column: "ParentId"); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjAirport_ParentId", - table: "ObjAirport", - column: "ParentId"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjAirport_Objects_ParentId", - table: "ObjAirport", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjBridge_Objects_ParentId", - table: "ObjBridge", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjBuilding_Objects_ParentId", - table: "ObjBuilding", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCargo_Objects_ParentId", - table: "ObjCargo", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCliffEdge_Objects_ParentId", - table: "ObjCliffEdge", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjClimate_Objects_ParentId", - table: "ObjClimate", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCompetitor_Objects_ParentId", - table: "ObjCompetitor", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCurrency_Objects_ParentId", - table: "ObjCurrency", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjDock_Objects_ParentId", - table: "ObjDock", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjHillShapes_Objects_ParentId", - table: "ObjHillShapes", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjIndustry_Objects_ParentId", - table: "ObjIndustry", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjInterface_Objects_ParentId", - table: "ObjInterface", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjLand_Objects_ParentId", - table: "ObjLand", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjLevelCrossing_Objects_ParentId", - table: "ObjLevelCrossing", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRegion_Objects_ParentId", - table: "ObjRegion", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRoad_Objects_ParentId", - table: "ObjRoad", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRoadExtra_Objects_ParentId", - table: "ObjRoadExtra", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRoadStation_Objects_ParentId", - table: "ObjRoadStation", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjScaffolding_Objects_ParentId", - table: "ObjScaffolding", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjScenarioText_Objects_ParentId", - table: "ObjScenarioText", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjSnow_Objects_ParentId", - table: "ObjSnow", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjSound_Objects_ParentId", - table: "ObjSound", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjSteam_Objects_ParentId", - table: "ObjSteam", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjStreetLight_Objects_ParentId", - table: "ObjStreetLight", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTownNames_Objects_ParentId", - table: "ObjTownNames", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrack_Objects_ParentId", - table: "ObjTrack", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrackExtra_Objects_ParentId", - table: "ObjTrackExtra", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrackSignal_Objects_ParentId", - table: "ObjTrackSignal", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrackStation_Objects_ParentId", - table: "ObjTrackStation", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTree_Objects_ParentId", - table: "ObjTree", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTunnel_Objects_ParentId", - table: "ObjTunnel", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjVehicle_Objects_ParentId", - table: "ObjVehicle", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjWall_Objects_ParentId", - table: "ObjWall", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjWater_Objects_ParentId", - table: "ObjWater", - column: "ParentId", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjAirport_Objects_ParentId", - table: "ObjAirport"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjBridge_Objects_ParentId", - table: "ObjBridge"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjBuilding_Objects_ParentId", - table: "ObjBuilding"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCargo_Objects_ParentId", - table: "ObjCargo"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCliffEdge_Objects_ParentId", - table: "ObjCliffEdge"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjClimate_Objects_ParentId", - table: "ObjClimate"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCompetitor_Objects_ParentId", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjCurrency_Objects_ParentId", - table: "ObjCurrency"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjDock_Objects_ParentId", - table: "ObjDock"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjHillShapes_Objects_ParentId", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjIndustry_Objects_ParentId", - table: "ObjIndustry"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjInterface_Objects_ParentId", - table: "ObjInterface"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjLand_Objects_ParentId", - table: "ObjLand"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjLevelCrossing_Objects_ParentId", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRegion_Objects_ParentId", - table: "ObjRegion"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRoad_Objects_ParentId", - table: "ObjRoad"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRoadExtra_Objects_ParentId", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjRoadStation_Objects_ParentId", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjScaffolding_Objects_ParentId", - table: "ObjScaffolding"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjScenarioText_Objects_ParentId", - table: "ObjScenarioText"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjSnow_Objects_ParentId", - table: "ObjSnow"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjSound_Objects_ParentId", - table: "ObjSound"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjSteam_Objects_ParentId", - table: "ObjSteam"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjStreetLight_Objects_ParentId", - table: "ObjStreetLight"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTownNames_Objects_ParentId", - table: "ObjTownNames"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrack_Objects_ParentId", - table: "ObjTrack"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrackExtra_Objects_ParentId", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrackSignal_Objects_ParentId", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTrackStation_Objects_ParentId", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTree_Objects_ParentId", - table: "ObjTree"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjTunnel_Objects_ParentId", - table: "ObjTunnel"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjVehicle_Objects_ParentId", - table: "ObjVehicle"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjWall_Objects_ParentId", - table: "ObjWall"); - - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjWater_Objects_ParentId", - table: "ObjWater"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjWater_ParentId", - table: "ObjWater"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjWall_ParentId", - table: "ObjWall"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjVehicle_ParentId", - table: "ObjVehicle"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTunnel_ParentId", - table: "ObjTunnel"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTree_ParentId", - table: "ObjTree"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrackStation_ParentId", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrackSignal_ParentId", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrackExtra_ParentId", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrack_ParentId", - table: "ObjTrack"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTownNames_ParentId", - table: "ObjTownNames"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjStreetLight_ParentId", - table: "ObjStreetLight"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjSteam_ParentId", - table: "ObjSteam"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjSound_ParentId", - table: "ObjSound"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjSnow_ParentId", - table: "ObjSnow"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjScenarioText_ParentId", - table: "ObjScenarioText"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjScaffolding_ParentId", - table: "ObjScaffolding"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRoadStation_ParentId", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRoadExtra_ParentId", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRoad_ParentId", - table: "ObjRoad"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRegion_ParentId", - table: "ObjRegion"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjLevelCrossing_ParentId", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjLand_ParentId", - table: "ObjLand"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjInterface_ParentId", - table: "ObjInterface"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjIndustry_ParentId", - table: "ObjIndustry"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjHillShapes_ParentId", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjDock_ParentId", - table: "ObjDock"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCurrency_ParentId", - table: "ObjCurrency"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCompetitor_ParentId", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjClimate_ParentId", - table: "ObjClimate"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCliffEdge_ParentId", - table: "ObjCliffEdge"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCargo_ParentId", - table: "ObjCargo"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjBuilding_ParentId", - table: "ObjBuilding"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjBridge_ParentId", - table: "ObjBridge"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjAirport_ParentId", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjWater"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjWall"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjTunnel"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjTownNames"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjStreetLight"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjSteam"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjSound"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjSnow"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjScenarioText"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjScaffolding"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjRegion"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropColumn( - name: "SubObjectId", - table: "Objects"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjCurrency"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjClimate"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjCliffEdge"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjAirport"); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjAirport_Objects_Id", - table: "ObjAirport", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjBridge_Objects_Id", - table: "ObjBridge", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjBuilding_Objects_Id", - table: "ObjBuilding", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCargo_Objects_Id", - table: "ObjCargo", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCliffEdge_Objects_Id", - table: "ObjCliffEdge", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjClimate_Objects_Id", - table: "ObjClimate", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCompetitor_Objects_Id", - table: "ObjCompetitor", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjCurrency_Objects_Id", - table: "ObjCurrency", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjDock_Objects_Id", - table: "ObjDock", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjHillShapes_Objects_Id", - table: "ObjHillShapes", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjIndustry_Objects_Id", - table: "ObjIndustry", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjInterface_Objects_Id", - table: "ObjInterface", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjLand_Objects_Id", - table: "ObjLand", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjLevelCrossing_Objects_Id", - table: "ObjLevelCrossing", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRegion_Objects_Id", - table: "ObjRegion", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRoad_Objects_Id", - table: "ObjRoad", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRoadExtra_Objects_Id", - table: "ObjRoadExtra", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjRoadStation_Objects_Id", - table: "ObjRoadStation", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjScaffolding_Objects_Id", - table: "ObjScaffolding", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjScenarioText_Objects_Id", - table: "ObjScenarioText", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjSnow_Objects_Id", - table: "ObjSnow", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjSound_Objects_Id", - table: "ObjSound", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjSteam_Objects_Id", - table: "ObjSteam", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjStreetLight_Objects_Id", - table: "ObjStreetLight", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTownNames_Objects_Id", - table: "ObjTownNames", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrack_Objects_Id", - table: "ObjTrack", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrackExtra_Objects_Id", - table: "ObjTrackExtra", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrackSignal_Objects_Id", - table: "ObjTrackSignal", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTrackStation_Objects_Id", - table: "ObjTrackStation", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTree_Objects_Id", - table: "ObjTree", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjTunnel_Objects_Id", - table: "ObjTunnel", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjVehicle_Objects_Id", - table: "ObjVehicle", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjWall_Objects_Id", - table: "ObjWall", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - _ = migrationBuilder.AddForeignKey( - name: "FK_ObjWater_Objects_Id", - table: "ObjWater", - column: "Id", - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } -} diff --git a/Definitions/Migrations/20250630053246_SubObjectFKIndex.Designer.cs b/Definitions/Migrations/20250630053246_SubObjectFKIndex.Designer.cs deleted file mode 100644 index c770ed84..00000000 --- a/Definitions/Migrations/20250630053246_SubObjectFKIndex.Designer.cs +++ /dev/null @@ -1,1951 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250630053246_SubObjectFKIndex")] - partial class SubObjectFKIndex - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("SubObjectId") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjAirport"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBridge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBuilding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCargo"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCliffEdge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjClimate"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCompetitor"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCurrency"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjDock"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjHillShapes"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjIndustry"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjInterface"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLand"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLevelCrossing"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRegion"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoad"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScaffolding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScenarioText"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSnow"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSound"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSteam"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjStreetLight"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTownNames"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrack"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackSignal"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTree"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTunnel"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjVehicle"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWall"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWater"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250630053246_SubObjectFKIndex.cs b/Definitions/Migrations/20250630053246_SubObjectFKIndex.cs deleted file mode 100644 index 6a678a35..00000000 --- a/Definitions/Migrations/20250630053246_SubObjectFKIndex.cs +++ /dev/null @@ -1,357 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class SubObjectFKIndex : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.CreateIndex( - name: "IX_ObjWater_Id", - table: "ObjWater", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjWall_Id", - table: "ObjWall", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjVehicle_Id", - table: "ObjVehicle", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTunnel_Id", - table: "ObjTunnel", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTree_Id", - table: "ObjTree", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackStation_Id", - table: "ObjTrackStation", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackSignal_Id", - table: "ObjTrackSignal", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrackExtra_Id", - table: "ObjTrackExtra", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTrack_Id", - table: "ObjTrack", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjTownNames_Id", - table: "ObjTownNames", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjStreetLight_Id", - table: "ObjStreetLight", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSteam_Id", - table: "ObjSteam", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSound_Id", - table: "ObjSound", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjSnow_Id", - table: "ObjSnow", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjScenarioText_Id", - table: "ObjScenarioText", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjScaffolding_Id", - table: "ObjScaffolding", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoadStation_Id", - table: "ObjRoadStation", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoadExtra_Id", - table: "ObjRoadExtra", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRoad_Id", - table: "ObjRoad", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjRegion_Id", - table: "ObjRegion", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjLevelCrossing_Id", - table: "ObjLevelCrossing", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjLand_Id", - table: "ObjLand", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjInterface_Id", - table: "ObjInterface", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjIndustry_Id", - table: "ObjIndustry", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjHillShapes_Id", - table: "ObjHillShapes", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjDock_Id", - table: "ObjDock", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCurrency_Id", - table: "ObjCurrency", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCompetitor_Id", - table: "ObjCompetitor", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjClimate_Id", - table: "ObjClimate", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCliffEdge_Id", - table: "ObjCliffEdge", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjCargo_Id", - table: "ObjCargo", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjBuilding_Id", - table: "ObjBuilding", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjBridge_Id", - table: "ObjBridge", - column: "Id", - unique: true); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjAirport_Id", - table: "ObjAirport", - column: "Id", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropIndex( - name: "IX_ObjWater_Id", - table: "ObjWater"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjWall_Id", - table: "ObjWall"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjVehicle_Id", - table: "ObjVehicle"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTunnel_Id", - table: "ObjTunnel"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTree_Id", - table: "ObjTree"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrackStation_Id", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrackSignal_Id", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrackExtra_Id", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTrack_Id", - table: "ObjTrack"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjTownNames_Id", - table: "ObjTownNames"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjStreetLight_Id", - table: "ObjStreetLight"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjSteam_Id", - table: "ObjSteam"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjSound_Id", - table: "ObjSound"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjSnow_Id", - table: "ObjSnow"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjScenarioText_Id", - table: "ObjScenarioText"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjScaffolding_Id", - table: "ObjScaffolding"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRoadStation_Id", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRoadExtra_Id", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRoad_Id", - table: "ObjRoad"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjRegion_Id", - table: "ObjRegion"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjLevelCrossing_Id", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjLand_Id", - table: "ObjLand"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjInterface_Id", - table: "ObjInterface"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjIndustry_Id", - table: "ObjIndustry"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjHillShapes_Id", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjDock_Id", - table: "ObjDock"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCurrency_Id", - table: "ObjCurrency"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCompetitor_Id", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjClimate_Id", - table: "ObjClimate"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCliffEdge_Id", - table: "ObjCliffEdge"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjCargo_Id", - table: "ObjCargo"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjBuilding_Id", - table: "ObjBuilding"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjBridge_Id", - table: "ObjBridge"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjAirport_Id", - table: "ObjAirport"); - } -} diff --git a/Definitions/Migrations/20250630055651_SubObjectClimate.Designer.cs b/Definitions/Migrations/20250630055651_SubObjectClimate.Designer.cs deleted file mode 100644 index eedf6a91..00000000 --- a/Definitions/Migrations/20250630055651_SubObjectClimate.Designer.cs +++ /dev/null @@ -1,1972 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250630055651_SubObjectClimate")] - partial class SubObjectClimate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("SubObjectId") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjAirport"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBridge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBuilding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCargo"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCliffEdge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FirstSeason") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength1") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength2") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength3") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength4") - .HasColumnType("INTEGER"); - - b.Property("SummerSnowLine") - .HasColumnType("INTEGER"); - - b.Property("WinterSnowLine") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjClimate"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCompetitor"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCurrency"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjDock"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjHillShapes"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjIndustry"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjInterface"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLand"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLevelCrossing"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRegion"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoad"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScaffolding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScenarioText"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSnow"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSound"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSteam"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjStreetLight"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTownNames"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrack"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackSignal"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTree"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTunnel"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjVehicle"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWall"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWater"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250630055651_SubObjectClimate.cs b/Definitions/Migrations/20250630055651_SubObjectClimate.cs deleted file mode 100644 index 15e31d9e..00000000 --- a/Definitions/Migrations/20250630055651_SubObjectClimate.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class SubObjectClimate : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.AddColumn( - name: "FirstSeason", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength1", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength2", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength3", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength4", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SummerSnowLine", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WinterSnowLine", - table: "ObjClimate", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropColumn( - name: "FirstSeason", - table: "ObjClimate"); - - _ = migrationBuilder.DropColumn( - name: "SeasonLength1", - table: "ObjClimate"); - - _ = migrationBuilder.DropColumn( - name: "SeasonLength2", - table: "ObjClimate"); - - _ = migrationBuilder.DropColumn( - name: "SeasonLength3", - table: "ObjClimate"); - - _ = migrationBuilder.DropColumn( - name: "SeasonLength4", - table: "ObjClimate"); - - _ = migrationBuilder.DropColumn( - name: "SummerSnowLine", - table: "ObjClimate"); - - _ = migrationBuilder.DropColumn( - name: "WinterSnowLine", - table: "ObjClimate"); - } -} diff --git a/Definitions/Migrations/20250701061712_SubObjectAll.Designer.cs b/Definitions/Migrations/20250701061712_SubObjectAll.Designer.cs deleted file mode 100644 index 448f86d0..00000000 --- a/Definitions/Migrations/20250701061712_SubObjectAll.Designer.cs +++ /dev/null @@ -1,2683 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250701061712_SubObjectAll")] - partial class SubObjectAll - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("SubObjectId") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AllowedPlaneTypes") - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("LargeTiles") - .HasColumnType("INTEGER"); - - b.Property("MaxX") - .HasColumnType("INTEGER"); - - b.Property("MaxY") - .HasColumnType("INTEGER"); - - b.Property("MinX") - .HasColumnType("INTEGER"); - - b.Property("MinY") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjAirport"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BaseCostFactor") - .HasColumnType("INTEGER"); - - b.Property("ClearHeight") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DeckDepth") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("DisabledTrackFlags") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("HeightCostFactor") - .HasColumnType("INTEGER"); - - b.Property("MaxHeight") - .HasColumnType("INTEGER"); - - b.Property("MaxSpeed") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("PillarSpacing") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("SpanLength") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBridge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AverageNumberOnMap") - .HasColumnType("INTEGER"); - - b.Property("Colours") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DemolishRatingReduction") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("GeneratorFunction") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingColour") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingSegmentType") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBuilding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CargoCategory") - .HasColumnType("INTEGER"); - - b.Property("CargoTransferTime") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("MaxNonPremiumDays") - .HasColumnType("INTEGER"); - - b.Property("MaxPremiumRate") - .HasColumnType("INTEGER"); - - b.Property("NumPlatformVariations") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("PaymentFactor") - .HasColumnType("INTEGER"); - - b.Property("PaymentIndex") - .HasColumnType("INTEGER"); - - b.Property("PenaltyRate") - .HasColumnType("INTEGER"); - - b.Property("PremiumDays") - .HasColumnType("INTEGER"); - - b.Property("StationCargoDensity") - .HasColumnType("INTEGER"); - - b.Property("UnitSize") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCargo"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCliffEdge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FirstSeason") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength1") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength2") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength3") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength4") - .HasColumnType("INTEGER"); - - b.Property("SummerSnowLine") - .HasColumnType("INTEGER"); - - b.Property("WinterSnowLine") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjClimate"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Aggressiveness") - .HasColumnType("INTEGER"); - - b.Property("AvailableNamePrefixes") - .HasColumnType("INTEGER"); - - b.Property("AvailablePlaystyles") - .HasColumnType("INTEGER"); - - b.Property("Competitiveness") - .HasColumnType("INTEGER"); - - b.Property("Emotions") - .HasColumnType("INTEGER"); - - b.Property("Intelligence") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCompetitor"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Factor") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("Separator") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCurrency"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BoatPositionX") - .HasColumnType("INTEGER"); - - b.Property("BoatPositionY") - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumBuildingPartAnimations") - .HasColumnType("INTEGER"); - - b.Property("NumBuildingVariationParts") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjDock"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("HillHeightMapCount") - .HasColumnType("INTEGER"); - - b.Property("MountainHeightMapCount") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjHillShapes"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("BuildingSizeFlags") - .HasColumnType("INTEGER"); - - b.Property("BuildingWall") - .HasColumnType("INTEGER"); - - b.Property("BuildingWallEntrance") - .HasColumnType("INTEGER"); - - b.Property("Colours") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("FarmGrowthStageWithNoProduction") - .HasColumnType("INTEGER"); - - b.Property("FarmIdealSize") - .HasColumnType("INTEGER"); - - b.Property("FarmImagesPerGrowthStage") - .HasColumnType("INTEGER"); - - b.Property("FarmNumStagesOfGrowth") - .HasColumnType("INTEGER"); - - b.Property("FarmTileNumImageAngles") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("MapColour") - .HasColumnType("INTEGER"); - - b.Property("MaxNumBuildings") - .HasColumnType("INTEGER"); - - b.Property("MinNumBuildings") - .HasColumnType("INTEGER"); - - b.Property("MonthlyClosureChance") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingColour") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingSegmentType") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TotalOfTypeInScenario") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjIndustry"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Colour_11") - .HasColumnType("INTEGER"); - - b.Property("ErrorColour") - .HasColumnType("INTEGER"); - - b.Property("MapTooltipCargoColour") - .HasColumnType("INTEGER"); - - b.Property("MapTooltipObjectColour") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("PlayerInfoToolbarColour") - .HasColumnType("INTEGER"); - - b.Property("TimeToolbarColour") - .HasColumnType("INTEGER"); - - b.Property("TooltipColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarPrimaryColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarQuaternaryColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarSecondaryColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarTertiaryColour") - .HasColumnType("INTEGER"); - - b.Property("WindowColour") - .HasColumnType("INTEGER"); - - b.Property("WindowConstructionColour") - .HasColumnType("INTEGER"); - - b.Property("WindowMapColour") - .HasColumnType("INTEGER"); - - b.Property("WindowOptionsColour") - .HasColumnType("INTEGER"); - - b.Property("WindowPlayerColor") - .HasColumnType("INTEGER"); - - b.Property("WindowTerraFormColour") - .HasColumnType("INTEGER"); - - b.Property("WindowTitlebarColour") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjInterface"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CliffEdgeHeader1") - .HasColumnType("INTEGER"); - - b.Property("CliffEdgeHeader2") - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DistributionPattern") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumGrowthStages") - .HasColumnType("INTEGER"); - - b.Property("NumImageAngles") - .HasColumnType("INTEGER"); - - b.Property("NumImagesPerGrowthStage") - .HasColumnType("INTEGER"); - - b.Property("NumVariations") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("VariationLikelihood") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLand"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AnimationSpeed") - .HasColumnType("INTEGER"); - - b.Property("ClosedFrames") - .HasColumnType("INTEGER"); - - b.Property("ClosingFrames") - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLevelCrossing"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRegion"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DisplayOffset") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("MaxSpeed") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("RoadPieces") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TargetTownSize") - .HasColumnType("INTEGER"); - - b.Property("Tunnel") - .HasColumnType("INTEGER"); - - b.Property("TunnelCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoad"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("RoadPieces") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CargoTypeId") - .HasColumnType("INTEGER"); - - b.Property("CompatibleRoadObjectCount") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("RoadPieces") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScaffolding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScenarioText"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSnow"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Length") - .HasColumnType("INTEGER"); - - b.Property("Offset") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSound"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumStationaryTicks") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SpriteHeightNegative") - .HasColumnType("INTEGER"); - - b.Property("SpriteHeightPositive") - .HasColumnType("INTEGER"); - - b.Property("SpriteWidth") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSteam"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjStreetLight"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTownNames"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("CurveSpeed") - .HasColumnType("INTEGER"); - - b.Property("DisplayOffset") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("StationTrackPieces") - .HasColumnType("INTEGER"); - - b.Property("TrackPieces") - .HasColumnType("INTEGER"); - - b.Property("Tunnel") - .HasColumnType("INTEGER"); - - b.Property("TunnelCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrack"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TrackPieces") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AnimationSpeed") - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumFrames") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackSignal"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.PrimitiveCollection("CargoOffsetBytes") - .IsRequired() - .HasColumnType("TEXT"); - - b.PrimitiveCollection("CompatibleTrack") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.PrimitiveCollection("ManualPower") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TrackPieces") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("ClearCostFactor") - .HasColumnType("INTEGER"); - - b.Property("Clearance") - .HasColumnType("INTEGER"); - - b.Property("Colours") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DemolishRatingReduction") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.Property("NumGrowthStages") - .HasColumnType("INTEGER"); - - b.Property("NumRotations") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("Season") - .HasColumnType("INTEGER"); - - b.Property("SeasonState") - .HasColumnType("INTEGER"); - - b.Property("ShadowImageOffset") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTree"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTunnel"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("DrivingSoundType") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Mode") - .HasColumnType("INTEGER"); - - b.Property("NumCarComponents") - .HasColumnType("INTEGER"); - - b.Property("NumCompatibleVehicles") - .HasColumnType("INTEGER"); - - b.Property("NumRequiredTrackExtras") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("Power") - .HasColumnType("INTEGER"); - - b.Property("RackRailType") - .HasColumnType("INTEGER"); - - b.Property("RackSpeed") - .HasColumnType("INTEGER"); - - b.Property("Reliability") - .HasColumnType("INTEGER"); - - b.Property("RunCostFactor") - .HasColumnType("INTEGER"); - - b.Property("RunCostIndex") - .HasColumnType("INTEGER"); - - b.Property("ShipWakeOffset") - .HasColumnType("INTEGER"); - - b.Property("Speed") - .HasColumnType("INTEGER"); - - b.Property("TrackTypeId") - .HasColumnType("INTEGER"); - - b.Property("Type") - .HasColumnType("INTEGER"); - - b.Property("Weight") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjVehicle"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Flags1") - .HasColumnType("INTEGER"); - - b.Property("Flags2") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("ToolId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWall"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWater"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250701061712_SubObjectAll.cs b/Definitions/Migrations/20250701061712_SubObjectAll.cs deleted file mode 100644 index a10e0fd7..00000000 --- a/Definitions/Migrations/20250701061712_SubObjectAll.cs +++ /dev/null @@ -1,2613 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class SubObjectAll : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.AddColumn( - name: "CostFactor", - table: "ObjWater", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjWater", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags1", - table: "ObjWall", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags2", - table: "ObjWall", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Height", - table: "ObjWall", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ToolId", - table: "ObjWall", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "CostFactor", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "DrivingSoundType", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Mode", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumCarComponents", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumCompatibleVehicles", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumRequiredTrackExtras", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Power", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "RackRailType", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "RackSpeed", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "Reliability", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "RunCostFactor", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "RunCostIndex", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ShipWakeOffset", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Speed", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "TrackTypeId", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Type", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Weight", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "ClearCostFactor", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "Clearance", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Colours", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DemolishRatingReduction", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Height", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumGrowthStages", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumRotations", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Rating", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "Season", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SeasonState", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ShadowImageOffset", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CargoOffsetBytes", - table: "ObjTrackStation", - type: "TEXT", - nullable: false, - defaultValue: "[]"); - - _ = migrationBuilder.AddColumn( - name: "CompatibleTrack", - table: "ObjTrackStation", - type: "TEXT", - nullable: false, - defaultValue: "[]"); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Height", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ManualPower", - table: "ObjTrackStation", - type: "TEXT", - nullable: false, - defaultValue: "[]"); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "PaintStyle", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "TrackPieces", - table: "ObjTrackStation", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "AnimationSpeed", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "NumFrames", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjTrackSignal", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjTrackExtra", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjTrackExtra", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "PaintStyle", - table: "ObjTrackExtra", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjTrackExtra", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "TrackPieces", - table: "ObjTrackExtra", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "CurveSpeed", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "DisplayOffset", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "StationTrackPieces", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "TrackPieces", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Tunnel", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "TunnelCostFactor", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjSteam", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "NumStationaryTicks", - table: "ObjSteam", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SpriteHeightNegative", - table: "ObjSteam", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SpriteHeightPositive", - table: "ObjSteam", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SpriteWidth", - table: "ObjSteam", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Length", - table: "ObjSound", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "Offset", - table: "ObjSound", - type: "INTEGER", - nullable: false, - defaultValue: 0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CargoTypeId", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "CompatibleRoadObjectCount", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Height", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "PaintStyle", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "RoadPieces", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjRoadExtra", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjRoadExtra", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "PaintStyle", - table: "ObjRoadExtra", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "RoadPieces", - table: "ObjRoadExtra", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjRoadExtra", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DisplayOffset", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "MaxSpeed", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "PaintStyle", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "RoadPieces", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "TargetTownSize", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Tunnel", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "TunnelCostFactor", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "AnimationSpeed", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ClosedFrames", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ClosingFrames", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "CostFactor", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjLevelCrossing", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CliffEdgeHeader1", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "CliffEdgeHeader2", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "CostFactor", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DistributionPattern", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumGrowthStages", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumImageAngles", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumImagesPerGrowthStage", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "NumVariations", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "VariationLikelihood", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Colour_11", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ErrorColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MapTooltipCargoColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MapTooltipObjectColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "PlayerInfoToolbarColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "TimeToolbarColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "TooltipColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarPrimaryColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarQuaternaryColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarSecondaryColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarTertiaryColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WindowColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WindowConstructionColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WindowMapColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WindowOptionsColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WindowPlayerColor", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WindowTerraFormColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "WindowTitlebarColour", - table: "ObjInterface", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "BuildingSizeFlags", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "BuildingWall", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "BuildingWallEntrance", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "Colours", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "FarmGrowthStageWithNoProduction", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "FarmIdealSize", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "FarmImagesPerGrowthStage", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "FarmNumStagesOfGrowth", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "FarmTileNumImageAngles", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "MapColour", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MaxNumBuildings", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MinNumBuildings", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MonthlyClosureChance", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "ScaffoldingColour", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ScaffoldingSegmentType", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "TotalOfTypeInScenario", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjHillShapes", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "HillHeightMapCount", - table: "ObjHillShapes", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MountainHeightMapCount", - table: "ObjHillShapes", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "BoatPositionX", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "BoatPositionY", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "NumBuildingPartAnimations", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "NumBuildingVariationParts", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjDock", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "Factor", - table: "ObjCurrency", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Separator", - table: "ObjCurrency", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Aggressiveness", - table: "ObjCompetitor", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "AvailableNamePrefixes", - table: "ObjCompetitor", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "AvailablePlaystyles", - table: "ObjCompetitor", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "Competitiveness", - table: "ObjCompetitor", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Emotions", - table: "ObjCompetitor", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "Intelligence", - table: "ObjCompetitor", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "CargoCategory", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "CargoTransferTime", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MaxNonPremiumDays", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MaxPremiumRate", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "NumPlatformVariations", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "PaymentFactor", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "PaymentIndex", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "PenaltyRate", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "PremiumDays", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "StationCargoDensity", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "UnitSize", - table: "ObjCargo", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "AverageNumberOnMap", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "Colours", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DemolishRatingReduction", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "GeneratorFunction", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "ScaffoldingColour", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ScaffoldingSegmentType", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjBuilding", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "BaseCostFactor", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "ClearHeight", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DeckDepth", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "DisabledTrackFlags", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "HeightCostFactor", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "MaxHeight", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "MaxSpeed", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "PillarSpacing", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "SpanLength", - table: "ObjBridge", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "AllowedPlaneTypes", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - - _ = migrationBuilder.AddColumn( - name: "CostIndex", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "LargeTiles", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: 0u); - - _ = migrationBuilder.AddColumn( - name: "MaxX", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (sbyte)0); - - _ = migrationBuilder.AddColumn( - name: "MaxY", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (sbyte)0); - - _ = migrationBuilder.AddColumn( - name: "MinX", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (sbyte)0); - - _ = migrationBuilder.AddColumn( - name: "MinY", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (sbyte)0); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (ushort)0); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "ObjAirport", - type: "INTEGER", - nullable: false, - defaultValue: (short)0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropColumn( - name: "CostFactor", - table: "ObjWater"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjWater"); - - _ = migrationBuilder.DropColumn( - name: "Flags1", - table: "ObjWall"); - - _ = migrationBuilder.DropColumn( - name: "Flags2", - table: "ObjWall"); - - _ = migrationBuilder.DropColumn( - name: "Height", - table: "ObjWall"); - - _ = migrationBuilder.DropColumn( - name: "ToolId", - table: "ObjWall"); - - _ = migrationBuilder.DropColumn( - name: "CostFactor", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "DrivingSoundType", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "Mode", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "NumCarComponents", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "NumCompatibleVehicles", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "NumRequiredTrackExtras", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "Power", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "RackRailType", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "RackSpeed", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "Reliability", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "RunCostFactor", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "RunCostIndex", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "ShipWakeOffset", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "Speed", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "TrackTypeId", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "Type", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "Weight", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "ClearCostFactor", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "Clearance", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "Colours", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "DemolishRatingReduction", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "Height", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "NumGrowthStages", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "NumRotations", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "Rating", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "Season", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "SeasonState", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "ShadowImageOffset", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "CargoOffsetBytes", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "CompatibleTrack", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "Height", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "ManualPower", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "PaintStyle", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "TrackPieces", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "AnimationSpeed", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "NumFrames", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjTrackSignal"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropColumn( - name: "PaintStyle", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropColumn( - name: "TrackPieces", - table: "ObjTrackExtra"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "CurveSpeed", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "DisplayOffset", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "StationTrackPieces", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "TrackPieces", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "Tunnel", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "TunnelCostFactor", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjSteam"); - - _ = migrationBuilder.DropColumn( - name: "NumStationaryTicks", - table: "ObjSteam"); - - _ = migrationBuilder.DropColumn( - name: "SpriteHeightNegative", - table: "ObjSteam"); - - _ = migrationBuilder.DropColumn( - name: "SpriteHeightPositive", - table: "ObjSteam"); - - _ = migrationBuilder.DropColumn( - name: "SpriteWidth", - table: "ObjSteam"); - - _ = migrationBuilder.DropColumn( - name: "Length", - table: "ObjSound"); - - _ = migrationBuilder.DropColumn( - name: "Offset", - table: "ObjSound"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "CargoTypeId", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "CompatibleRoadObjectCount", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "Height", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "PaintStyle", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "RoadPieces", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropColumn( - name: "PaintStyle", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropColumn( - name: "RoadPieces", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjRoadExtra"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "DisplayOffset", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "MaxSpeed", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "PaintStyle", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "RoadPieces", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "TargetTownSize", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "Tunnel", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "TunnelCostFactor", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "AnimationSpeed", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "ClosedFrames", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "ClosingFrames", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "CostFactor", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjLevelCrossing"); - - _ = migrationBuilder.DropColumn( - name: "CliffEdgeHeader1", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "CliffEdgeHeader2", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "CostFactor", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "DistributionPattern", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "NumGrowthStages", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "NumImageAngles", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "NumImagesPerGrowthStage", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "NumVariations", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "VariationLikelihood", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "Colour_11", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "ErrorColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "MapTooltipCargoColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "MapTooltipObjectColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "PlayerInfoToolbarColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "TimeToolbarColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "TooltipColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "TopToolbarPrimaryColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "TopToolbarQuaternaryColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "TopToolbarSecondaryColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "TopToolbarTertiaryColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "WindowColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "WindowConstructionColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "WindowMapColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "WindowOptionsColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "WindowPlayerColor", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "WindowTerraFormColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "WindowTitlebarColour", - table: "ObjInterface"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "BuildingSizeFlags", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "BuildingWall", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "BuildingWallEntrance", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "Colours", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "FarmGrowthStageWithNoProduction", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "FarmIdealSize", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "FarmImagesPerGrowthStage", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "FarmNumStagesOfGrowth", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "FarmTileNumImageAngles", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "MapColour", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "MaxNumBuildings", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "MinNumBuildings", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "MonthlyClosureChance", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "ScaffoldingColour", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "ScaffoldingSegmentType", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "TotalOfTypeInScenario", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropColumn( - name: "HillHeightMapCount", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropColumn( - name: "MountainHeightMapCount", - table: "ObjHillShapes"); - - _ = migrationBuilder.DropColumn( - name: "BoatPositionX", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "BoatPositionY", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "NumBuildingPartAnimations", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "NumBuildingVariationParts", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjDock"); - - _ = migrationBuilder.DropColumn( - name: "Factor", - table: "ObjCurrency"); - - _ = migrationBuilder.DropColumn( - name: "Separator", - table: "ObjCurrency"); - - _ = migrationBuilder.DropColumn( - name: "Aggressiveness", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropColumn( - name: "AvailableNamePrefixes", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropColumn( - name: "AvailablePlaystyles", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropColumn( - name: "Competitiveness", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropColumn( - name: "Emotions", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropColumn( - name: "Intelligence", - table: "ObjCompetitor"); - - _ = migrationBuilder.DropColumn( - name: "CargoCategory", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "CargoTransferTime", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "MaxNonPremiumDays", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "MaxPremiumRate", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "NumPlatformVariations", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "PaymentFactor", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "PaymentIndex", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "PenaltyRate", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "PremiumDays", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "StationCargoDensity", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "UnitSize", - table: "ObjCargo"); - - _ = migrationBuilder.DropColumn( - name: "AverageNumberOnMap", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "Colours", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "DemolishRatingReduction", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "GeneratorFunction", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "ScaffoldingColour", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "ScaffoldingSegmentType", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjBuilding"); - - _ = migrationBuilder.DropColumn( - name: "BaseCostFactor", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "ClearHeight", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "DeckDepth", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "DisabledTrackFlags", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "Flags", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "HeightCostFactor", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "MaxHeight", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "MaxSpeed", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "PillarSpacing", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "SpanLength", - table: "ObjBridge"); - - _ = migrationBuilder.DropColumn( - name: "AllowedPlaneTypes", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "BuildCostFactor", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "CostIndex", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "DesignedYear", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "LargeTiles", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "MaxX", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "MaxY", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "MinX", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "MinY", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "ObsoleteYear", - table: "ObjAirport"); - - _ = migrationBuilder.DropColumn( - name: "SellCostFactor", - table: "ObjAirport"); - } -} diff --git a/Definitions/Migrations/20250702021058_SubObjectUpdates.Designer.cs b/Definitions/Migrations/20250702021058_SubObjectUpdates.Designer.cs deleted file mode 100644 index 84e0b7f4..00000000 --- a/Definitions/Migrations/20250702021058_SubObjectUpdates.Designer.cs +++ /dev/null @@ -1,2641 +0,0 @@ -// -using Definitions.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -#nullable disable - -namespace Definitions.Database.Migrations; - - [DbContext(typeof(LocoDbContext))] - [Migration("20250702021058_SubObjectUpdates")] - partial class SubObjectUpdates - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblAuthor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Authors"); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("DatChecksum") - .HasColumnType("INTEGER"); - - b.Property("DatName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("xxHash3") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("xxHash3") - .IsUnique(); - - b.HasIndex("DatName", "DatChecksum") - .IsUnique() - .IsDescending(true, false); - - b.ToTable("DatObjects"); - }); - - modelBuilder.Entity("Definitions.Database.TblLicence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Licences"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Availability") - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("ObjectType") - .HasColumnType("INTEGER"); - - b.Property("SubObjectId") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.Property("VehicleType") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Objects"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AllowedPlaneTypes") - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("LargeTiles") - .HasColumnType("INTEGER"); - - b.Property("MaxX") - .HasColumnType("INTEGER"); - - b.Property("MaxY") - .HasColumnType("INTEGER"); - - b.Property("MinX") - .HasColumnType("INTEGER"); - - b.Property("MinY") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjAirport"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BaseCostFactor") - .HasColumnType("INTEGER"); - - b.Property("ClearHeight") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DeckDepth") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("DisabledTrackFlags") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("HeightCostFactor") - .HasColumnType("INTEGER"); - - b.Property("MaxHeight") - .HasColumnType("INTEGER"); - - b.Property("MaxSpeed") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("PillarSpacing") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("SpanLength") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBridge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AverageNumberOnMap") - .HasColumnType("INTEGER"); - - b.Property("Colours") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DemolishRatingReduction") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("GeneratorFunction") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingColour") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingSegmentType") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjBuilding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CargoCategory") - .HasColumnType("INTEGER"); - - b.Property("CargoTransferTime") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("MaxNonPremiumDays") - .HasColumnType("INTEGER"); - - b.Property("MaxPremiumRate") - .HasColumnType("INTEGER"); - - b.Property("NumPlatformVariations") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("PaymentFactor") - .HasColumnType("INTEGER"); - - b.Property("PaymentIndex") - .HasColumnType("INTEGER"); - - b.Property("PenaltyRate") - .HasColumnType("INTEGER"); - - b.Property("PremiumDays") - .HasColumnType("INTEGER"); - - b.Property("StationCargoDensity") - .HasColumnType("INTEGER"); - - b.Property("UnitSize") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCargo"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCliffEdge"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("FirstSeason") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength1") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength2") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength3") - .HasColumnType("INTEGER"); - - b.Property("SeasonLength4") - .HasColumnType("INTEGER"); - - b.Property("SummerSnowLine") - .HasColumnType("INTEGER"); - - b.Property("WinterSnowLine") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjClimate"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Aggressiveness") - .HasColumnType("INTEGER"); - - b.Property("AvailableNamePrefixes") - .HasColumnType("INTEGER"); - - b.Property("AvailablePlaystyles") - .HasColumnType("INTEGER"); - - b.Property("Competitiveness") - .HasColumnType("INTEGER"); - - b.Property("Emotions") - .HasColumnType("INTEGER"); - - b.Property("Intelligence") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCompetitor"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Factor") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("Separator") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjCurrency"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BoatPositionX") - .HasColumnType("INTEGER"); - - b.Property("BoatPositionY") - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumBuildingPartAnimations") - .HasColumnType("INTEGER"); - - b.Property("NumBuildingVariationParts") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjDock"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("HillHeightMapCount") - .HasColumnType("INTEGER"); - - b.Property("MountainHeightMapCount") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjHillShapes"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("BuildingSizeFlags") - .HasColumnType("INTEGER"); - - b.Property("Colours") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("FarmGrowthStageWithNoProduction") - .HasColumnType("INTEGER"); - - b.Property("FarmIdealSize") - .HasColumnType("INTEGER"); - - b.Property("FarmImagesPerGrowthStage") - .HasColumnType("INTEGER"); - - b.Property("FarmNumStagesOfGrowth") - .HasColumnType("INTEGER"); - - b.Property("FarmTileNumImageAngles") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("MapColour") - .HasColumnType("INTEGER"); - - b.Property("MaxNumBuildings") - .HasColumnType("INTEGER"); - - b.Property("MinNumBuildings") - .HasColumnType("INTEGER"); - - b.Property("MonthlyClosureChance") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingColour") - .HasColumnType("INTEGER"); - - b.Property("ScaffoldingSegmentType") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TotalOfTypeInScenario") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjIndustry"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Colour_11") - .HasColumnType("INTEGER"); - - b.Property("ErrorColour") - .HasColumnType("INTEGER"); - - b.Property("MapTooltipCargoColour") - .HasColumnType("INTEGER"); - - b.Property("MapTooltipObjectColour") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("PlayerInfoToolbarColour") - .HasColumnType("INTEGER"); - - b.Property("TimeToolbarColour") - .HasColumnType("INTEGER"); - - b.Property("TooltipColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarPrimaryColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarQuaternaryColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarSecondaryColour") - .HasColumnType("INTEGER"); - - b.Property("TopToolbarTertiaryColour") - .HasColumnType("INTEGER"); - - b.Property("WindowColour") - .HasColumnType("INTEGER"); - - b.Property("WindowConstructionColour") - .HasColumnType("INTEGER"); - - b.Property("WindowMapColour") - .HasColumnType("INTEGER"); - - b.Property("WindowOptionsColour") - .HasColumnType("INTEGER"); - - b.Property("WindowPlayerColor") - .HasColumnType("INTEGER"); - - b.Property("WindowTerraFormColour") - .HasColumnType("INTEGER"); - - b.Property("WindowTitlebarColour") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjInterface"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DistributionPattern") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumGrowthStages") - .HasColumnType("INTEGER"); - - b.Property("NumImageAngles") - .HasColumnType("INTEGER"); - - b.Property("NumImagesPerGrowthStage") - .HasColumnType("INTEGER"); - - b.Property("NumVariations") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("VariationLikelihood") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLand"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AnimationSpeed") - .HasColumnType("INTEGER"); - - b.Property("ClosedFrames") - .HasColumnType("INTEGER"); - - b.Property("ClosingFrames") - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjLevelCrossing"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("ObjectPacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRegion"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DisplayOffset") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("MaxSpeed") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("RoadPieces") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TargetTownSize") - .HasColumnType("INTEGER"); - - b.Property("TunnelCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoad"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("RoadPieces") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CompatibleRoadObjectCount") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("RoadPieces") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjRoadStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScaffolding"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjScenarioText"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSnow"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("ShouldLoop") - .HasColumnType("INTEGER"); - - b.Property("Volume") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSound"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumStationaryTicks") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SpriteHeightNegative") - .HasColumnType("INTEGER"); - - b.Property("SpriteHeightPositive") - .HasColumnType("INTEGER"); - - b.Property("SpriteWidth") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjSteam"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjStreetLight"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTownNames"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("CurveSpeed") - .HasColumnType("INTEGER"); - - b.Property("DisplayOffset") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("StationTrackPieces") - .HasColumnType("INTEGER"); - - b.Property("TrackPieces") - .HasColumnType("INTEGER"); - - b.Property("TunnelCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrack"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TrackPieces") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackExtra"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AnimationSpeed") - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("NumFrames") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackSignal"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("PaintStyle") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("SellCostFactor") - .HasColumnType("INTEGER"); - - b.Property("TrackPieces") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTrackStation"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("BuildCostFactor") - .HasColumnType("INTEGER"); - - b.Property("ClearCostFactor") - .HasColumnType("INTEGER"); - - b.Property("Clearance") - .HasColumnType("INTEGER"); - - b.Property("Colours") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DemolishRatingReduction") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.Property("NumGrowthStages") - .HasColumnType("INTEGER"); - - b.Property("NumRotations") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("Rating") - .HasColumnType("INTEGER"); - - b.Property("Season") - .HasColumnType("INTEGER"); - - b.Property("SeasonState") - .HasColumnType("INTEGER"); - - b.Property("ShadowImageOffset") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTree"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjTunnel"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("DesignedYear") - .HasColumnType("INTEGER"); - - b.Property("DrivingSoundType") - .HasColumnType("INTEGER"); - - b.Property("Flags") - .HasColumnType("INTEGER"); - - b.Property("Mode") - .HasColumnType("INTEGER"); - - b.Property("NumCarComponents") - .HasColumnType("INTEGER"); - - b.Property("NumCompatibleVehicles") - .HasColumnType("INTEGER"); - - b.Property("NumRequiredTrackExtras") - .HasColumnType("INTEGER"); - - b.Property("ObsoleteYear") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.Property("Power") - .HasColumnType("INTEGER"); - - b.Property("RackSpeed") - .HasColumnType("INTEGER"); - - b.Property("Reliability") - .HasColumnType("INTEGER"); - - b.Property("RunCostFactor") - .HasColumnType("INTEGER"); - - b.Property("RunCostIndex") - .HasColumnType("INTEGER"); - - b.Property("ShipWakeOffset") - .HasColumnType("INTEGER"); - - b.Property("Speed") - .HasColumnType("INTEGER"); - - b.Property("TrackTypeId") - .HasColumnType("INTEGER"); - - b.Property("Type") - .HasColumnType("INTEGER"); - - b.Property("Weight") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjVehicle"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Flags1") - .HasColumnType("INTEGER"); - - b.Property("Height") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWall"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CostFactor") - .HasColumnType("INTEGER"); - - b.Property("CostIndex") - .HasColumnType("INTEGER"); - - b.Property("ParentId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("Id") - .IsUnique(); - - b.HasIndex("ParentId"); - - b.ToTable("ObjWater"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectSource") - .HasColumnType("INTEGER"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5Files"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("Description") - .HasColumnType("TEXT"); - - b.Property("LicenceId") - .HasColumnType("INTEGER"); - - b.Property("ModifiedDate") - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("UploadedDate") - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("TEXT") - .HasDefaultValueSql("datetime(datetime('now', 'localtime'), 'utc')"); - - b.HasKey("Id"); - - b.HasIndex("LicenceId"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("SC5FilePacks"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Language") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("ObjectId") - .HasColumnType("INTEGER"); - - b.Property("Text") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ObjectId"); - - b.HasIndex("Text"); - - b.ToTable("StringTable"); - }); - - modelBuilder.Entity("Definitions.Database.TblTag", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("Tags"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblAuthorTblObject"); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "ObjectPacksId"); - - b.HasIndex("ObjectPacksId"); - - b.ToTable("TblAuthorTblObjectPack"); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblAuthorTblSC5File"); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.Property("AuthorsId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.HasKey("AuthorsId", "SC5FilePacksId"); - - b.HasIndex("SC5FilePacksId"); - - b.ToTable("TblAuthorTblSC5FilePack"); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectPackTblTag"); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.Property("ObjectPacksId") - .HasColumnType("INTEGER"); - - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectPacksId", "ObjectsId"); - - b.HasIndex("ObjectsId"); - - b.ToTable("TblObjectTblObjectPack"); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.Property("ObjectsId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("ObjectsId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblObjectTblTag"); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FilePackTblTag"); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.Property("SC5FilePacksId") - .HasColumnType("INTEGER"); - - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilePacksId", "SC5FilesId"); - - b.HasIndex("SC5FilesId"); - - b.ToTable("TblSC5FileTblSC5FilePack"); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.Property("SC5FilesId") - .HasColumnType("INTEGER"); - - b.Property("TagsId") - .HasColumnType("INTEGER"); - - b.HasKey("SC5FilesId", "TagsId"); - - b.HasIndex("TagsId"); - - b.ToTable("TblSC5FileTblTag"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblDatObject", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("DatObjects") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectAirport", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBridge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectBuilding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCargo", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCliffEdge", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectClimate", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCompetitor", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectCurrency", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectDock", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectHillShapes", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectIndustry", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectInterface", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLand", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectLevelCrossing", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectPack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRegion", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoad", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectRoadStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScaffolding", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectScenarioText", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSnow", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSound", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectSteam", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectStreetLight", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTownNames", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrack", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackExtra", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackSignal", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTrackStation", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTree", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectTunnel", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectVehicle", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWall", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblObjectWater", b => - { - b.HasOne("Definitions.Database.TblObject", "Parent") - .WithMany() - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Parent"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5File", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblLicence", "Licence") - .WithMany() - .HasForeignKey("LicenceId"); - - b.Navigation("Licence"); - }); - - modelBuilder.Entity("Definitions.Database.TblStringTableRow", b => - { - b.HasOne("Definitions.Database.TblObject", "Object") - .WithMany("StringTable") - .HasForeignKey("ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Object"); - }); - - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("TblAuthorTblObject", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5File", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblAuthorTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblAuthor", null) - .WithMany() - .HasForeignKey("AuthorsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectPackTblTag", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblObjectPack", b => - { - b.HasOne("Definitions.Database.TblObjectPack", null) - .WithMany() - .HasForeignKey("ObjectPacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblObjectTblTag", b => - { - b.HasOne("Definitions.Database.TblObject", null) - .WithMany() - .HasForeignKey("ObjectsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FilePackTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblSC5FilePack", b => - { - b.HasOne("Definitions.Database.TblSC5FilePack", null) - .WithMany() - .HasForeignKey("SC5FilePacksId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("TblSC5FileTblTag", b => - { - b.HasOne("Definitions.Database.TblSC5File", null) - .WithMany() - .HasForeignKey("SC5FilesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblTag", null) - .WithMany() - .HasForeignKey("TagsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Definitions.Database.TblObject", b => - { - b.Navigation("DatObjects"); - - b.Navigation("StringTable"); - }); -#pragma warning restore 612, 618 - } - } diff --git a/Definitions/Migrations/20250702021058_SubObjectUpdates.cs b/Definitions/Migrations/20250702021058_SubObjectUpdates.cs deleted file mode 100644 index cc96aac0..00000000 --- a/Definitions/Migrations/20250702021058_SubObjectUpdates.cs +++ /dev/null @@ -1,180 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class SubObjectUpdates : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropColumn( - name: "Flags2", - table: "ObjWall"); - - _ = migrationBuilder.DropColumn( - name: "ToolId", - table: "ObjWall"); - - _ = migrationBuilder.DropColumn( - name: "RackRailType", - table: "ObjVehicle"); - - _ = migrationBuilder.DropColumn( - name: "CargoOffsetBytes", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "CompatibleTrack", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "ManualPower", - table: "ObjTrackStation"); - - _ = migrationBuilder.DropColumn( - name: "Tunnel", - table: "ObjTrack"); - - _ = migrationBuilder.DropColumn( - name: "CargoTypeId", - table: "ObjRoadStation"); - - _ = migrationBuilder.DropColumn( - name: "Tunnel", - table: "ObjRoad"); - - _ = migrationBuilder.DropColumn( - name: "CliffEdgeHeader1", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "CliffEdgeHeader2", - table: "ObjLand"); - - _ = migrationBuilder.DropColumn( - name: "BuildingWall", - table: "ObjIndustry"); - - _ = migrationBuilder.DropColumn( - name: "BuildingWallEntrance", - table: "ObjIndustry"); - - _ = migrationBuilder.RenameColumn( - name: "Offset", - table: "ObjSound", - newName: "Volume"); - - _ = migrationBuilder.RenameColumn( - name: "Length", - table: "ObjSound", - newName: "ShouldLoop"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.RenameColumn( - name: "Volume", - table: "ObjSound", - newName: "Offset"); - - _ = migrationBuilder.RenameColumn( - name: "ShouldLoop", - table: "ObjSound", - newName: "Length"); - - _ = migrationBuilder.AddColumn( - name: "Flags2", - table: "ObjWall", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "ToolId", - table: "ObjWall", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "RackRailType", - table: "ObjVehicle", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "CargoOffsetBytes", - table: "ObjTrackStation", - type: "TEXT", - nullable: false, - defaultValue: ""); - - _ = migrationBuilder.AddColumn( - name: "CompatibleTrack", - table: "ObjTrackStation", - type: "TEXT", - nullable: false, - defaultValue: ""); - - _ = migrationBuilder.AddColumn( - name: "ManualPower", - table: "ObjTrackStation", - type: "TEXT", - nullable: false, - defaultValue: ""); - - _ = migrationBuilder.AddColumn( - name: "Tunnel", - table: "ObjTrack", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "CargoTypeId", - table: "ObjRoadStation", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "Tunnel", - table: "ObjRoad", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "CliffEdgeHeader1", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "CliffEdgeHeader2", - table: "ObjLand", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "BuildingWall", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - - _ = migrationBuilder.AddColumn( - name: "BuildingWallEntrance", - table: "ObjIndustry", - type: "INTEGER", - nullable: false, - defaultValue: 0ul); - } -} diff --git a/Definitions/Migrations/20250709052238_DefaultDateTime.cs b/Definitions/Migrations/20250709052238_DefaultDateTime.cs deleted file mode 100644 index 05ab930f..00000000 --- a/Definitions/Migrations/20250709052238_DefaultDateTime.cs +++ /dev/null @@ -1,1623 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations; - -/// -public partial class DefaultDateTime : Migration -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "SC5Files", - type: "TEXT", - nullable: false, - defaultValueSql: "date('now')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')"); - - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "SC5FilePacks", - type: "TEXT", - nullable: false, - defaultValueSql: "date('now')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')"); - - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "Objects", - type: "TEXT", - nullable: false, - defaultValueSql: "date('now')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')"); - - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "ObjectPacks", - type: "TEXT", - nullable: false, - defaultValueSql: "date('now')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropForeignKey( - name: "FK_ObjWater_Objects_ParentId", - table: "ObjWater"); - - _ = migrationBuilder.DropTable( - name: "ObjAirport"); - - _ = migrationBuilder.DropTable( - name: "ObjBridge"); - - _ = migrationBuilder.DropTable( - name: "ObjBuilding"); - - _ = migrationBuilder.DropTable( - name: "ObjCargo"); - - _ = migrationBuilder.DropTable( - name: "ObjCliffEdge"); - - _ = migrationBuilder.DropTable( - name: "ObjClimate"); - - _ = migrationBuilder.DropTable( - name: "ObjCompetitor"); - - _ = migrationBuilder.DropTable( - name: "ObjCurrency"); - - _ = migrationBuilder.DropTable( - name: "ObjDock"); - - _ = migrationBuilder.DropTable( - name: "ObjHillShapes"); - - _ = migrationBuilder.DropTable( - name: "ObjIndustry"); - - _ = migrationBuilder.DropTable( - name: "ObjInterface"); - - _ = migrationBuilder.DropTable( - name: "ObjLand"); - - _ = migrationBuilder.DropTable( - name: "ObjLevelCrossing"); - - _ = migrationBuilder.DropTable( - name: "ObjRegion"); - - _ = migrationBuilder.DropTable( - name: "ObjRoad"); - - _ = migrationBuilder.DropTable( - name: "ObjRoadExtra"); - - _ = migrationBuilder.DropTable( - name: "ObjRoadStation"); - - _ = migrationBuilder.DropTable( - name: "ObjScaffolding"); - - _ = migrationBuilder.DropTable( - name: "ObjScenarioText"); - - _ = migrationBuilder.DropTable( - name: "ObjSnow"); - - _ = migrationBuilder.DropTable( - name: "ObjSound"); - - _ = migrationBuilder.DropTable( - name: "ObjSteam"); - - _ = migrationBuilder.DropTable( - name: "ObjStreetLight"); - - _ = migrationBuilder.DropTable( - name: "ObjTownNames"); - - _ = migrationBuilder.DropTable( - name: "ObjTrack"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackExtra"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackSignal"); - - _ = migrationBuilder.DropTable( - name: "ObjTrackStation"); - - _ = migrationBuilder.DropTable( - name: "ObjTree"); - - _ = migrationBuilder.DropTable( - name: "ObjTunnel"); - - _ = migrationBuilder.DropTable( - name: "ObjVehicle"); - - _ = migrationBuilder.DropTable( - name: "ObjWall"); - - _ = migrationBuilder.DropPrimaryKey( - name: "PK_ObjWater", - table: "ObjWater"); - - _ = migrationBuilder.DropIndex( - name: "IX_ObjWater_ParentId", - table: "ObjWater"); - - _ = migrationBuilder.DropColumn( - name: "ParentId", - table: "ObjWater"); - - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "SC5Files", - type: "TEXT", - nullable: false, - defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "date('now')"); - - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "SC5FilePacks", - type: "TEXT", - nullable: false, - defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "date('now')"); - - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "Objects", - type: "TEXT", - nullable: false, - defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "date('now')"); - - _ = migrationBuilder.AlterColumn( - name: "UploadedDate", - table: "ObjectPacks", - type: "TEXT", - nullable: false, - defaultValueSql: "datetime(datetime('now', 'localtime'), 'utc')", - oldClrType: typeof(DateOnly), - oldType: "TEXT", - oldDefaultValueSql: "date('now')"); - - _ = migrationBuilder.AlterColumn( - name: "CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true, - oldClrType: typeof(byte), - oldType: "INTEGER"); - - _ = migrationBuilder.AlterColumn( - name: "CostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true, - oldClrType: typeof(short), - oldType: "INTEGER"); - - _ = migrationBuilder.AddColumn( - name: "Aggressiveness", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "AllowedPlaneTypes", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "AnimationSpeed", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "AvailableNamePrefixes", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "AvailablePlaystyles", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "AverageNumberOnMap", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "BaseCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "BoatPositionX", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "BoatPositionY", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "BuildingSizeFlags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "CargoCategory", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "CargoTransferTime", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ClearCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ClearHeight", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Clearance", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ClosedFrames", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ClosingFrames", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Colour_11", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Colours", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "CompatibleRoadObjectCount", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Competitiveness", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "CurveSpeed", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "DeckDepth", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "DemolishRatingReduction", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "DisabledTrackFlags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Discriminator", - table: "DbSubObject", - type: "TEXT", - maxLength: 34, - nullable: false, - defaultValue: ""); - - _ = migrationBuilder.AddColumn( - name: "DisplayOffset", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "DistributionPattern", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "DrivingSoundType", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Emotions", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ErrorColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Factor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "FarmGrowthStageWithNoProduction", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "FarmIdealSize", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "FarmImagesPerGrowthStage", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "FarmNumStagesOfGrowth", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "FarmTileNumImageAngles", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "FirstSeason", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Flags1", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "GeneratorFunction", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Height", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "HeightCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "HillHeightMapCount", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Intelligence", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "LargeTiles", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MapColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MapTooltipCargoColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MapTooltipObjectColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MaxHeight", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MaxNonPremiumDays", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MaxNumBuildings", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MaxPremiumRate", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MaxSpeed", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MaxX", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MaxY", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MinNumBuildings", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MinX", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MinY", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Mode", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MonthlyClosureChance", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "MountainHeightMapCount", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumBuildingPartAnimations", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumBuildingVariationParts", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumCarComponents", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumCompatibleVehicles", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumFrames", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumGrowthStages", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumImageAngles", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumImagesPerGrowthStage", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumPlatformVariations", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumRequiredTrackExtras", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumRotations", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumStationaryTicks", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "NumVariations", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "PaintStyle", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "PaymentFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "PaymentIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "PenaltyRate", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "PillarSpacing", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "PlayerInfoToolbarColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Power", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "PremiumDays", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "RackSpeed", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Rating", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Reliability", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "RoadPieces", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "RunCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "RunCostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ScaffoldingColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ScaffoldingSegmentType", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Season", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength1", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength2", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength3", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SeasonLength4", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SeasonState", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Separator", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ShadowImageOffset", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ShipWakeOffset", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "ShouldLoop", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SpanLength", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Speed", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SpriteHeightNegative", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SpriteHeightPositive", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SpriteWidth", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "StationCargoDensity", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "StationTrackPieces", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "SummerSnowLine", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TargetTownSize", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBridge_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBridge_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBridge_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBuilding_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBuilding_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBuilding_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBuilding_ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectBuilding_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectCargo_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectDock_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectDock_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectDock_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectDock_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectDock_ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectDock_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectHillShapes_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_Colours", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_ScaffoldingColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_ScaffoldingSegmentType", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectIndustry_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectLand_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectLand_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectLevelCrossing_CostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectLevelCrossing_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectLevelCrossing_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectLevelCrossing_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadExtra_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadExtra_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadExtra_PaintStyle", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadExtra_RoadPieces", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadExtra_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_PaintStyle", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_RoadPieces", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoadStation_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoad_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoad_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoad_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoad_MaxSpeed", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectRoad_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectSteam_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackExtra_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackExtra_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackExtra_PaintStyle", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackExtra_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackExtra_TrackPieces", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackSignal_AnimationSpeed", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackSignal_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackSignal_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackSignal_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackSignal_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackSignal_ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackSignal_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_Height", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_PaintStyle", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrackStation_TrackPieces", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrack_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrack_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrack_DisplayOffset", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrack_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrack_SellCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTrack_TunnelCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTree_BuildCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTree_Colours", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTree_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTree_DemolishRatingReduction", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTree_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTree_Height", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectTree_NumGrowthStages", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectVehicle_CostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectVehicle_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectVehicle_DesignedYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectVehicle_Flags", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectVehicle_ObsoleteYear", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectWall_Height", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectWater_CostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TblObjectWater_CostIndex", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TimeToolbarColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TooltipColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarPrimaryColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarQuaternaryColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarSecondaryColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TopToolbarTertiaryColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TotalOfTypeInScenario", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TrackPieces", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TrackTypeId", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "TunnelCostFactor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Type", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "UnitSize", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "VariationLikelihood", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Volume", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "Weight", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WindowColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WindowConstructionColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WindowMapColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WindowOptionsColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WindowPlayerColor", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WindowTerraFormColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WindowTitlebarColour", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddColumn( - name: "WinterSnowLine", - table: "DbSubObject", - type: "INTEGER", - nullable: true); - - _ = migrationBuilder.AddPrimaryKey( - name: "PK_DbSubObject", - table: "DbSubObject", - column: "Id"); - - _ = migrationBuilder.CreateIndex( - name: "IX_Objects_SubObjectId", - table: "Objects", - column: "SubObjectId", - unique: true); - - _ = migrationBuilder.AddForeignKey( - name: "FK_Objects_DbSubObject_SubObjectId", - table: "Objects", - column: "SubObjectId", - principalTable: "DbSubObject", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } -} diff --git a/Definitions/Migrations/20251228122835_AddTblObjectMissing.cs b/Definitions/Migrations/20251228122835_AddTblObjectMissing.cs deleted file mode 100644 index ce91a614..00000000 --- a/Definitions/Migrations/20251228122835_AddTblObjectMissing.cs +++ /dev/null @@ -1,155 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Definitions.Database.Migrations -{ - /// - public partial class AddTblObjectMissing : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.RenameColumn( - name: "ShipWakeOffset", - table: "ObjVehicle", - newName: "ShipWakeSpacing"); - - _ = migrationBuilder.RenameColumn( - name: "Clearance", - table: "ObjTree", - newName: "var_05"); - - _ = migrationBuilder.RenameColumn( - name: "DisplayOffset", - table: "ObjTrack", - newName: "VehicleDisplayListVerticalOffset"); - - _ = migrationBuilder.RenameColumn( - name: "DisplayOffset", - table: "ObjRoad", - newName: "VehicleDisplayListVerticalOffset"); - - _ = migrationBuilder.RenameColumn( - name: "WindowPlayerColor", - table: "ObjInterface", - newName: "WindowPlayerColour"); - - _ = migrationBuilder.RenameColumn( - name: "Flags", - table: "ObjHillShapes", - newName: "IsHeightMap"); - - _ = migrationBuilder.RenameColumn( - name: "MaxPremiumRate", - table: "ObjCargo", - newName: "NonPremiumRate"); - - _ = migrationBuilder.RenameColumn( - name: "AllowedPlaneTypes", - table: "ObjAirport", - newName: "Flags"); - - _ = migrationBuilder.AddColumn( - name: "InitialHeight", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "SeasonalVariants", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.AddColumn( - name: "var_04", - table: "ObjTree", - type: "INTEGER", - nullable: false, - defaultValue: (byte)0); - - _ = migrationBuilder.CreateTable( - name: "ObjectsMissing", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DatName = table.Column(type: "TEXT", nullable: false), - DatChecksum = table.Column(type: "INTEGER", nullable: false), - ObjectType = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - _ = table.PrimaryKey("PK_ObjectsMissing", x => x.Id); - }); - - _ = migrationBuilder.CreateIndex( - name: "IX_ObjectsMissing_DatName_DatChecksum", - table: "ObjectsMissing", - columns: ["DatName", "DatChecksum"], - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - _ = migrationBuilder.DropTable( - name: "ObjectsMissing"); - - _ = migrationBuilder.DropColumn( - name: "InitialHeight", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "SeasonalVariants", - table: "ObjTree"); - - _ = migrationBuilder.DropColumn( - name: "var_04", - table: "ObjTree"); - - _ = migrationBuilder.RenameColumn( - name: "ShipWakeSpacing", - table: "ObjVehicle", - newName: "ShipWakeOffset"); - - _ = migrationBuilder.RenameColumn( - name: "var_05", - table: "ObjTree", - newName: "Clearance"); - - _ = migrationBuilder.RenameColumn( - name: "VehicleDisplayListVerticalOffset", - table: "ObjTrack", - newName: "DisplayOffset"); - - _ = migrationBuilder.RenameColumn( - name: "VehicleDisplayListVerticalOffset", - table: "ObjRoad", - newName: "DisplayOffset"); - - _ = migrationBuilder.RenameColumn( - name: "WindowPlayerColour", - table: "ObjInterface", - newName: "WindowPlayerColor"); - - _ = migrationBuilder.RenameColumn( - name: "IsHeightMap", - table: "ObjHillShapes", - newName: "Flags"); - - _ = migrationBuilder.RenameColumn( - name: "NonPremiumRate", - table: "ObjCargo", - newName: "MaxPremiumRate"); - - _ = migrationBuilder.RenameColumn( - name: "Flags", - table: "ObjAirport", - newName: "AllowedPlaneTypes"); - } - } -} diff --git a/Definitions/Migrations/Identity/20260527111450_Initial.Designer.cs b/Definitions/Migrations/Identity/20260527111450_Initial.Designer.cs new file mode 100644 index 00000000..1f59d634 --- /dev/null +++ b/Definitions/Migrations/Identity/20260527111450_Initial.Designer.cs @@ -0,0 +1,270 @@ +// +using System; +using Definitions.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Definitions.Migrations.Identity +{ + [DbContext(typeof(IdentityContext))] + [Migration("20260527111450_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.8"); + + modelBuilder.Entity("Definitions.Database.TblUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("AssociatedAuthorId") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Definitions.Database.TblUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.Property("RoleId") + .HasColumnType("INTEGER"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Definitions.Database.TblUserRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Definitions.Database.TblUserRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Definitions/Migrations/Identity/20260527111450_Initial.cs b/Definitions/Migrations/Identity/20260527111450_Initial.cs new file mode 100644 index 00000000..d114d5cc --- /dev/null +++ b/Definitions/Migrations/Identity/20260527111450_Initial.cs @@ -0,0 +1,224 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Definitions.Migrations.Identity +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AssociatedAuthorId = table.Column(type: "INTEGER", nullable: true), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", nullable: true), + SecurityStamp = table.Column(type: "TEXT", nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), + PhoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(type: "INTEGER", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(type: "INTEGER", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "TEXT", nullable: false), + ProviderKey = table.Column(type: "TEXT", nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "INTEGER", nullable: false), + RoleId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "INTEGER", nullable: false), + LoginProvider = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + } + } +} diff --git a/Definitions/Migrations/Identity/IdentityContextModelSnapshot.cs b/Definitions/Migrations/Identity/IdentityContextModelSnapshot.cs new file mode 100644 index 00000000..99334d84 --- /dev/null +++ b/Definitions/Migrations/Identity/IdentityContextModelSnapshot.cs @@ -0,0 +1,267 @@ +// +using System; +using Definitions.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Definitions.Migrations.Identity +{ + [DbContext(typeof(IdentityContext))] + partial class IdentityContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.8"); + + modelBuilder.Entity("Definitions.Database.TblUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("AssociatedAuthorId") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Definitions.Database.TblUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.Property("RoleId") + .HasColumnType("INTEGER"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("INTEGER"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Definitions.Database.TblUserRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Definitions.Database.TblUserRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Definitions.Database.TblUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Definitions/Migrations/20250709052238_DefaultDateTime.Designer.cs b/Definitions/Migrations/Loco/20260527112357_Initial.Designer.cs similarity index 89% rename from Definitions/Migrations/20250709052238_DefaultDateTime.Designer.cs rename to Definitions/Migrations/Loco/20260527112357_Initial.Designer.cs index ece9d89c..c108cb34 100644 --- a/Definitions/Migrations/20250709052238_DefaultDateTime.Designer.cs +++ b/Definitions/Migrations/Loco/20260527112357_Initial.Designer.cs @@ -1,123 +1,24 @@ -// +// +using System; using Definitions.Database; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; #nullable disable -namespace Definitions.Database.Migrations; - +namespace Definitions.Migrations.Loco +{ [DbContext(typeof(LocoDbContext))] - [Migration("20250709052238_DefaultDateTime")] - partial class DefaultDateTime + [Migration("20260527112357_Initial")] + partial class Initial { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.6"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); + modelBuilder.HasAnnotation("ProductVersion", "10.0.8"); modelBuilder.Entity("Definitions.Database.TblAuthor", b => { @@ -250,9 +151,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("AllowedPlaneTypes") - .HasColumnType("INTEGER"); - b.Property("BuildCostFactor") .HasColumnType("INTEGER"); @@ -262,6 +160,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("DesignedYear") .HasColumnType("INTEGER"); + b.Property("Flags") + .HasColumnType("INTEGER"); + b.Property("LargeTiles") .HasColumnType("INTEGER"); @@ -424,7 +325,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("MaxNonPremiumDays") .HasColumnType("INTEGER"); - b.Property("MaxPremiumRate") + b.Property("NonPremiumRate") .HasColumnType("INTEGER"); b.Property("NumPlatformVariations") @@ -486,7 +387,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("FirstSeason") + b.Property("FirstSeason") .HasColumnType("INTEGER"); b.Property("ParentId") @@ -538,7 +439,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Competitiveness") .HasColumnType("INTEGER"); - b.Property("Emotions") + b.Property("Emotions") .HasColumnType("INTEGER"); b.Property("Intelligence") @@ -637,10 +538,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); - b.Property("Flags") + b.Property("HillHeightMapCount") .HasColumnType("INTEGER"); - b.Property("HillHeightMapCount") + b.Property("IsHeightMap") .HasColumnType("INTEGER"); b.Property("MountainHeightMapCount") @@ -792,7 +693,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("WindowOptionsColour") .HasColumnType("INTEGER"); - b.Property("WindowPlayerColor") + b.Property("WindowPlayerColour") .HasColumnType("INTEGER"); b.Property("WindowTerraFormColour") @@ -897,6 +798,30 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("ObjLevelCrossing"); }); + modelBuilder.Entity("Definitions.Database.TblObjectMissing", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("DatChecksum") + .HasColumnType("INTEGER"); + + b.Property("DatName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ObjectType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("DatName", "DatChecksum") + .IsUnique(); + + b.ToTable("ObjectsMissing"); + }); + modelBuilder.Entity("Definitions.Database.TblObjectPack", b => { b.Property("Id") @@ -965,9 +890,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("CostIndex") .HasColumnType("INTEGER"); - b.Property("DisplayOffset") - .HasColumnType("INTEGER"); - b.Property("Flags") .HasColumnType("INTEGER"); @@ -992,6 +914,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("TunnelCostFactor") .HasColumnType("INTEGER"); + b.Property("VehicleDisplayListVerticalOffset") + .HasColumnType("INTEGER"); + b.HasKey("Id"); b.HasIndex("Id") @@ -1254,9 +1179,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("CurveSpeed") .HasColumnType("INTEGER"); - b.Property("DisplayOffset") - .HasColumnType("INTEGER"); - b.Property("Flags") .HasColumnType("INTEGER"); @@ -1275,6 +1197,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("TunnelCostFactor") .HasColumnType("INTEGER"); + b.Property("VehicleDisplayListVerticalOffset") + .HasColumnType("INTEGER"); + b.HasKey("Id"); b.HasIndex("Id") @@ -1420,9 +1345,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("ClearCostFactor") .HasColumnType("INTEGER"); - b.Property("Clearance") - .HasColumnType("INTEGER"); - b.Property("Colours") .HasColumnType("INTEGER"); @@ -1438,6 +1360,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Height") .HasColumnType("INTEGER"); + b.Property("InitialHeight") + .HasColumnType("INTEGER"); + b.Property("NumGrowthStages") .HasColumnType("INTEGER"); @@ -1456,9 +1381,18 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("SeasonState") .HasColumnType("INTEGER"); + b.Property("SeasonalVariants") + .HasColumnType("INTEGER"); + b.Property("ShadowImageOffset") .HasColumnType("INTEGER"); + b.Property("var_04") + .HasColumnType("INTEGER"); + + b.Property("var_05") + .HasColumnType("INTEGER"); + b.HasKey("Id"); b.HasIndex("Id") @@ -1542,7 +1476,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("RunCostIndex") .HasColumnType("INTEGER"); - b.Property("ShipWakeOffset") + b.Property("ShipWakeSpacing") .HasColumnType("INTEGER"); b.Property("Speed") @@ -1741,103 +1675,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("Tags"); }); - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - modelBuilder.Entity("TblAuthorTblObject", b => { b.Property("AuthorsId") @@ -1988,57 +1825,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("TblSC5FileTblTag"); }); - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - modelBuilder.Entity("Definitions.Database.TblDatObject", b => { b.HasOne("Definitions.Database.TblObject", "Object") @@ -2471,15 +2257,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Navigation("Object"); }); - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - modelBuilder.Entity("TblAuthorTblObject", b => { b.HasOne("Definitions.Database.TblAuthor", null) @@ -2639,3 +2416,4 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) #pragma warning restore 612, 618 } } +} diff --git a/Definitions/Migrations/Loco/20260527112357_Initial.cs b/Definitions/Migrations/Loco/20260527112357_Initial.cs new file mode 100644 index 00000000..c69ed0b1 --- /dev/null +++ b/Definitions/Migrations/Loco/20260527112357_Initial.cs @@ -0,0 +1,2016 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Definitions.Migrations.Loco +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Authors", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Authors", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Licences", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Text = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Licences", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ObjectsMissing", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DatName = table.Column(type: "TEXT", nullable: false), + DatChecksum = table.Column(type: "INTEGER", nullable: false), + ObjectType = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjectsMissing", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Tags", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tags", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ObjectPacks", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_ObjectPacks", x => x.Id); + table.ForeignKey( + name: "FK_ObjectPacks_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "Objects", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + SubObjectId = table.Column(type: "INTEGER", nullable: false), + ObjectType = table.Column(type: "INTEGER", nullable: false), + ObjectSource = table.Column(type: "INTEGER", nullable: false), + VehicleType = table.Column(type: "INTEGER", nullable: true), + Availability = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_Objects", x => x.Id); + table.ForeignKey( + name: "FK_Objects_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "SC5FilePacks", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_SC5FilePacks", x => x.Id); + table.ForeignKey( + name: "FK_SC5FilePacks_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "SC5Files", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ObjectSource = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_SC5Files", x => x.Id); + table.ForeignKey( + name: "FK_SC5Files_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblObjectPack", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + ObjectPacksId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblObjectPack", x => new { x.AuthorsId, x.ObjectPacksId }); + table.ForeignKey( + name: "FK_TblAuthorTblObjectPack_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblObjectPack_ObjectPacks_ObjectPacksId", + column: x => x.ObjectPacksId, + principalTable: "ObjectPacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblObjectPackTblTag", + columns: table => new + { + ObjectPacksId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblObjectPackTblTag", x => new { x.ObjectPacksId, x.TagsId }); + table.ForeignKey( + name: "FK_TblObjectPackTblTag_ObjectPacks_ObjectPacksId", + column: x => x.ObjectPacksId, + principalTable: "ObjectPacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblObjectPackTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DatObjects", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DatName = table.Column(type: "TEXT", nullable: false), + DatChecksum = table.Column(type: "INTEGER", nullable: false), + xxHash3 = table.Column(type: "INTEGER", nullable: false), + ObjectId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DatObjects", x => x.Id); + table.ForeignKey( + name: "FK_DatObjects_Objects_ObjectId", + column: x => x.ObjectId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjAirport", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + LargeTiles = table.Column(type: "INTEGER", nullable: false), + MinX = table.Column(type: "INTEGER", nullable: false), + MinY = table.Column(type: "INTEGER", nullable: false), + MaxX = table.Column(type: "INTEGER", nullable: false), + MaxY = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjAirport", x => x.Id); + table.ForeignKey( + name: "FK_ObjAirport_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjBridge", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Flags = table.Column(type: "INTEGER", nullable: false), + ClearHeight = table.Column(type: "INTEGER", nullable: false), + DeckDepth = table.Column(type: "INTEGER", nullable: false), + SpanLength = table.Column(type: "INTEGER", nullable: false), + PillarSpacing = table.Column(type: "INTEGER", nullable: false), + MaxSpeed = table.Column(type: "INTEGER", nullable: false), + MaxHeight = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BaseCostFactor = table.Column(type: "INTEGER", nullable: false), + HeightCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + DisabledTrackFlags = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjBridge", x => x.Id); + table.ForeignKey( + name: "FK_ObjBridge_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjBuilding", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + DemolishRatingReduction = table.Column(type: "INTEGER", nullable: false), + ScaffoldingSegmentType = table.Column(type: "INTEGER", nullable: false), + ScaffoldingColour = table.Column(type: "INTEGER", nullable: false), + Colours = table.Column(type: "INTEGER", nullable: false), + GeneratorFunction = table.Column(type: "INTEGER", nullable: false), + AverageNumberOnMap = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjBuilding", x => x.Id); + table.ForeignKey( + name: "FK_ObjBuilding_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCargo", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CargoTransferTime = table.Column(type: "INTEGER", nullable: false), + CargoCategory = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + NumPlatformVariations = table.Column(type: "INTEGER", nullable: false), + StationCargoDensity = table.Column(type: "INTEGER", nullable: false), + PremiumDays = table.Column(type: "INTEGER", nullable: false), + MaxNonPremiumDays = table.Column(type: "INTEGER", nullable: false), + NonPremiumRate = table.Column(type: "INTEGER", nullable: false), + PenaltyRate = table.Column(type: "INTEGER", nullable: false), + PaymentFactor = table.Column(type: "INTEGER", nullable: false), + PaymentIndex = table.Column(type: "INTEGER", nullable: false), + UnitSize = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCargo", x => x.Id); + table.ForeignKey( + name: "FK_ObjCargo_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCliffEdge", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCliffEdge", x => x.Id); + table.ForeignKey( + name: "FK_ObjCliffEdge_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjClimate", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + FirstSeason = table.Column(type: "INTEGER", nullable: false), + WinterSnowLine = table.Column(type: "INTEGER", nullable: false), + SummerSnowLine = table.Column(type: "INTEGER", nullable: false), + SeasonLength1 = table.Column(type: "INTEGER", nullable: false), + SeasonLength2 = table.Column(type: "INTEGER", nullable: false), + SeasonLength3 = table.Column(type: "INTEGER", nullable: false), + SeasonLength4 = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjClimate", x => x.Id); + table.ForeignKey( + name: "FK_ObjClimate_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCompetitor", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AvailableNamePrefixes = table.Column(type: "INTEGER", nullable: false), + AvailablePlaystyles = table.Column(type: "INTEGER", nullable: false), + Emotions = table.Column(type: "INTEGER", nullable: false), + Intelligence = table.Column(type: "INTEGER", nullable: false), + Aggressiveness = table.Column(type: "INTEGER", nullable: false), + Competitiveness = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCompetitor", x => x.Id); + table.ForeignKey( + name: "FK_ObjCompetitor_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCurrency", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Separator = table.Column(type: "INTEGER", nullable: false), + Factor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCurrency", x => x.Id); + table.ForeignKey( + name: "FK_ObjCurrency_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjDock", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + NumBuildingPartAnimations = table.Column(type: "INTEGER", nullable: false), + NumBuildingVariationParts = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + BoatPositionX = table.Column(type: "INTEGER", nullable: false), + BoatPositionY = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjDock", x => x.Id); + table.ForeignKey( + name: "FK_ObjDock_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjHillShapes", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + HillHeightMapCount = table.Column(type: "INTEGER", nullable: false), + MountainHeightMapCount = table.Column(type: "INTEGER", nullable: false), + IsHeightMap = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjHillShapes", x => x.Id); + table.ForeignKey( + name: "FK_ObjHillShapes_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjIndustry", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + FarmImagesPerGrowthStage = table.Column(type: "INTEGER", nullable: false), + MinNumBuildings = table.Column(type: "INTEGER", nullable: false), + MaxNumBuildings = table.Column(type: "INTEGER", nullable: false), + Colours = table.Column(type: "INTEGER", nullable: false), + BuildingSizeFlags = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + TotalOfTypeInScenario = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + ScaffoldingSegmentType = table.Column(type: "INTEGER", nullable: false), + ScaffoldingColour = table.Column(type: "INTEGER", nullable: false), + MapColour = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + FarmTileNumImageAngles = table.Column(type: "INTEGER", nullable: false), + FarmGrowthStageWithNoProduction = table.Column(type: "INTEGER", nullable: false), + FarmIdealSize = table.Column(type: "INTEGER", nullable: false), + FarmNumStagesOfGrowth = table.Column(type: "INTEGER", nullable: false), + MonthlyClosureChance = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjIndustry", x => x.Id); + table.ForeignKey( + name: "FK_ObjIndustry_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjInterface", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + MapTooltipObjectColour = table.Column(type: "INTEGER", nullable: false), + MapTooltipCargoColour = table.Column(type: "INTEGER", nullable: false), + TooltipColour = table.Column(type: "INTEGER", nullable: false), + ErrorColour = table.Column(type: "INTEGER", nullable: false), + WindowPlayerColour = table.Column(type: "INTEGER", nullable: false), + WindowTitlebarColour = table.Column(type: "INTEGER", nullable: false), + WindowColour = table.Column(type: "INTEGER", nullable: false), + WindowConstructionColour = table.Column(type: "INTEGER", nullable: false), + WindowTerraFormColour = table.Column(type: "INTEGER", nullable: false), + WindowMapColour = table.Column(type: "INTEGER", nullable: false), + WindowOptionsColour = table.Column(type: "INTEGER", nullable: false), + Colour_11 = table.Column(type: "INTEGER", nullable: false), + TopToolbarPrimaryColour = table.Column(type: "INTEGER", nullable: false), + TopToolbarSecondaryColour = table.Column(type: "INTEGER", nullable: false), + TopToolbarTertiaryColour = table.Column(type: "INTEGER", nullable: false), + TopToolbarQuaternaryColour = table.Column(type: "INTEGER", nullable: false), + PlayerInfoToolbarColour = table.Column(type: "INTEGER", nullable: false), + TimeToolbarColour = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjInterface", x => x.Id); + table.ForeignKey( + name: "FK_ObjInterface_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjLand", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CostIndex = table.Column(type: "INTEGER", nullable: false), + NumGrowthStages = table.Column(type: "INTEGER", nullable: false), + NumImageAngles = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + CostFactor = table.Column(type: "INTEGER", nullable: false), + NumImagesPerGrowthStage = table.Column(type: "INTEGER", nullable: false), + DistributionPattern = table.Column(type: "INTEGER", nullable: false), + NumVariations = table.Column(type: "INTEGER", nullable: false), + VariationLikelihood = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjLand", x => x.Id); + table.ForeignKey( + name: "FK_ObjLand_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjLevelCrossing", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + AnimationSpeed = table.Column(type: "INTEGER", nullable: false), + ClosingFrames = table.Column(type: "INTEGER", nullable: false), + ClosedFrames = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjLevelCrossing", x => x.Id); + table.ForeignKey( + name: "FK_ObjLevelCrossing_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRegion", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRegion", x => x.Id); + table.ForeignKey( + name: "FK_ObjRegion_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRoad", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoadPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + TunnelCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + MaxSpeed = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + VehicleDisplayListVerticalOffset = table.Column(type: "INTEGER", nullable: false), + TargetTownSize = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRoad", x => x.Id); + table.ForeignKey( + name: "FK_ObjRoad_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRoadExtra", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoadPieces = table.Column(type: "INTEGER", nullable: false), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRoadExtra", x => x.Id); + table.ForeignKey( + name: "FK_ObjRoadExtra_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRoadStation", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + Height = table.Column(type: "INTEGER", nullable: false), + RoadPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + CompatibleRoadObjectCount = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRoadStation", x => x.Id); + table.ForeignKey( + name: "FK_ObjRoadStation_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjScaffolding", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjScaffolding", x => x.Id); + table.ForeignKey( + name: "FK_ObjScaffolding_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjScenarioText", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjScenarioText", x => x.Id); + table.ForeignKey( + name: "FK_ObjScenarioText_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjSnow", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjSnow", x => x.Id); + table.ForeignKey( + name: "FK_ObjSnow_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjSound", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ShouldLoop = table.Column(type: "INTEGER", nullable: false), + Volume = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjSound", x => x.Id); + table.ForeignKey( + name: "FK_ObjSound_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjSteam", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + NumStationaryTicks = table.Column(type: "INTEGER", nullable: false), + SpriteWidth = table.Column(type: "INTEGER", nullable: false), + SpriteHeightNegative = table.Column(type: "INTEGER", nullable: false), + SpriteHeightPositive = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjSteam", x => x.Id); + table.ForeignKey( + name: "FK_ObjSteam_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjStreetLight", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjStreetLight", x => x.Id); + table.ForeignKey( + name: "FK_ObjStreetLight_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTownNames", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTownNames", x => x.Id); + table.ForeignKey( + name: "FK_ObjTownNames_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrack", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + TrackPieces = table.Column(type: "INTEGER", nullable: false), + StationTrackPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + TunnelCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + CurveSpeed = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + VehicleDisplayListVerticalOffset = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrack", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrack_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrackExtra", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + TrackPieces = table.Column(type: "INTEGER", nullable: false), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrackExtra", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrackExtra_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrackSignal", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Flags = table.Column(type: "INTEGER", nullable: false), + AnimationSpeed = table.Column(type: "INTEGER", nullable: false), + NumFrames = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrackSignal", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrackSignal_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrackStation", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + Height = table.Column(type: "INTEGER", nullable: false), + TrackPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrackStation", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrackStation_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTree", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + InitialHeight = table.Column(type: "INTEGER", nullable: false), + Height = table.Column(type: "INTEGER", nullable: false), + var_04 = table.Column(type: "INTEGER", nullable: false), + var_05 = table.Column(type: "INTEGER", nullable: false), + NumRotations = table.Column(type: "INTEGER", nullable: false), + NumGrowthStages = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + ShadowImageOffset = table.Column(type: "INTEGER", nullable: false), + SeasonState = table.Column(type: "INTEGER", nullable: false), + Season = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + ClearCostFactor = table.Column(type: "INTEGER", nullable: false), + Colours = table.Column(type: "INTEGER", nullable: false), + Rating = table.Column(type: "INTEGER", nullable: false), + DemolishRatingReduction = table.Column(type: "INTEGER", nullable: false), + SeasonalVariants = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTree", x => x.Id); + table.ForeignKey( + name: "FK_ObjTree_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTunnel", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTunnel", x => x.Id); + table.ForeignKey( + name: "FK_ObjTunnel_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjVehicle", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Mode = table.Column(type: "INTEGER", nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + NumCarComponents = table.Column(type: "INTEGER", nullable: false), + TrackTypeId = table.Column(type: "INTEGER", nullable: false), + NumRequiredTrackExtras = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + CostFactor = table.Column(type: "INTEGER", nullable: false), + Reliability = table.Column(type: "INTEGER", nullable: false), + RunCostIndex = table.Column(type: "INTEGER", nullable: false), + RunCostFactor = table.Column(type: "INTEGER", nullable: false), + NumCompatibleVehicles = table.Column(type: "INTEGER", nullable: false), + Power = table.Column(type: "INTEGER", nullable: false), + Speed = table.Column(type: "INTEGER", nullable: false), + RackSpeed = table.Column(type: "INTEGER", nullable: false), + Weight = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + ShipWakeSpacing = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + DrivingSoundType = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjVehicle", x => x.Id); + table.ForeignKey( + name: "FK_ObjVehicle_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjWall", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Height = table.Column(type: "INTEGER", nullable: false), + Flags1 = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjWall", x => x.Id); + table.ForeignKey( + name: "FK_ObjWall_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjWater", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CostIndex = table.Column(type: "INTEGER", nullable: false), + CostFactor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjWater", x => x.Id); + table.ForeignKey( + name: "FK_ObjWater_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StringTable", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + Language = table.Column(type: "INTEGER", nullable: false), + Text = table.Column(type: "TEXT", nullable: false), + ObjectId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StringTable", x => x.Id); + table.ForeignKey( + name: "FK_StringTable_Objects_ObjectId", + column: x => x.ObjectId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblObject", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + ObjectsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblObject", x => new { x.AuthorsId, x.ObjectsId }); + table.ForeignKey( + name: "FK_TblAuthorTblObject_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblObject_Objects_ObjectsId", + column: x => x.ObjectsId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblObjectTblObjectPack", + columns: table => new + { + ObjectPacksId = table.Column(type: "INTEGER", nullable: false), + ObjectsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblObjectTblObjectPack", x => new { x.ObjectPacksId, x.ObjectsId }); + table.ForeignKey( + name: "FK_TblObjectTblObjectPack_ObjectPacks_ObjectPacksId", + column: x => x.ObjectPacksId, + principalTable: "ObjectPacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", + column: x => x.ObjectsId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblObjectTblTag", + columns: table => new + { + ObjectsId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblObjectTblTag", x => new { x.ObjectsId, x.TagsId }); + table.ForeignKey( + name: "FK_TblObjectTblTag_Objects_ObjectsId", + column: x => x.ObjectsId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblObjectTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblSC5FilePack", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + SC5FilePacksId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblSC5FilePack", x => new { x.AuthorsId, x.SC5FilePacksId }); + table.ForeignKey( + name: "FK_TblAuthorTblSC5FilePack_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblSC5FilePack_SC5FilePacks_SC5FilePacksId", + column: x => x.SC5FilePacksId, + principalTable: "SC5FilePacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblSC5FilePackTblTag", + columns: table => new + { + SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblSC5FilePackTblTag", x => new { x.SC5FilePacksId, x.TagsId }); + table.ForeignKey( + name: "FK_TblSC5FilePackTblTag_SC5FilePacks_SC5FilePacksId", + column: x => x.SC5FilePacksId, + principalTable: "SC5FilePacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblSC5FilePackTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblSC5File", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + SC5FilesId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblSC5File", x => new { x.AuthorsId, x.SC5FilesId }); + table.ForeignKey( + name: "FK_TblAuthorTblSC5File_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblSC5File_SC5Files_SC5FilesId", + column: x => x.SC5FilesId, + principalTable: "SC5Files", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblSC5FileTblSC5FilePack", + columns: table => new + { + SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), + SC5FilesId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblSC5FileTblSC5FilePack", x => new { x.SC5FilePacksId, x.SC5FilesId }); + table.ForeignKey( + name: "FK_TblSC5FileTblSC5FilePack_SC5FilePacks_SC5FilePacksId", + column: x => x.SC5FilePacksId, + principalTable: "SC5FilePacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblSC5FileTblSC5FilePack_SC5Files_SC5FilesId", + column: x => x.SC5FilesId, + principalTable: "SC5Files", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblSC5FileTblTag", + columns: table => new + { + SC5FilesId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblSC5FileTblTag", x => new { x.SC5FilesId, x.TagsId }); + table.ForeignKey( + name: "FK_TblSC5FileTblTag_SC5Files_SC5FilesId", + column: x => x.SC5FilesId, + principalTable: "SC5Files", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblSC5FileTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Authors_Name", + table: "Authors", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_DatObjects_DatName_DatChecksum", + table: "DatObjects", + columns: new[] { "DatName", "DatChecksum" }, + unique: true, + descending: new[] { true, false }); + + migrationBuilder.CreateIndex( + name: "IX_DatObjects_ObjectId", + table: "DatObjects", + column: "ObjectId"); + + migrationBuilder.CreateIndex( + name: "IX_DatObjects_xxHash3", + table: "DatObjects", + column: "xxHash3", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Licences_Name", + table: "Licences", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjAirport_Id", + table: "ObjAirport", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjAirport_ParentId", + table: "ObjAirport", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjBridge_Id", + table: "ObjBridge", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjBridge_ParentId", + table: "ObjBridge", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjBuilding_Id", + table: "ObjBuilding", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjBuilding_ParentId", + table: "ObjBuilding", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCargo_Id", + table: "ObjCargo", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCargo_ParentId", + table: "ObjCargo", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCliffEdge_Id", + table: "ObjCliffEdge", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCliffEdge_ParentId", + table: "ObjCliffEdge", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjClimate_Id", + table: "ObjClimate", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjClimate_ParentId", + table: "ObjClimate", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCompetitor_Id", + table: "ObjCompetitor", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCompetitor_ParentId", + table: "ObjCompetitor", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCurrency_Id", + table: "ObjCurrency", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCurrency_ParentId", + table: "ObjCurrency", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjDock_Id", + table: "ObjDock", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjDock_ParentId", + table: "ObjDock", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjectPacks_LicenceId", + table: "ObjectPacks", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjectPacks_Name", + table: "ObjectPacks", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Objects_LicenceId", + table: "Objects", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_Objects_Name", + table: "Objects", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjectsMissing_DatName_DatChecksum", + table: "ObjectsMissing", + columns: new[] { "DatName", "DatChecksum" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjHillShapes_Id", + table: "ObjHillShapes", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjHillShapes_ParentId", + table: "ObjHillShapes", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjIndustry_Id", + table: "ObjIndustry", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjIndustry_ParentId", + table: "ObjIndustry", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjInterface_Id", + table: "ObjInterface", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjInterface_ParentId", + table: "ObjInterface", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjLand_Id", + table: "ObjLand", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjLand_ParentId", + table: "ObjLand", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjLevelCrossing_Id", + table: "ObjLevelCrossing", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjLevelCrossing_ParentId", + table: "ObjLevelCrossing", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRegion_Id", + table: "ObjRegion", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRegion_ParentId", + table: "ObjRegion", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoad_Id", + table: "ObjRoad", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoad_ParentId", + table: "ObjRoad", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadExtra_Id", + table: "ObjRoadExtra", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadExtra_ParentId", + table: "ObjRoadExtra", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadStation_Id", + table: "ObjRoadStation", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadStation_ParentId", + table: "ObjRoadStation", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjScaffolding_Id", + table: "ObjScaffolding", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjScaffolding_ParentId", + table: "ObjScaffolding", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjScenarioText_Id", + table: "ObjScenarioText", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjScenarioText_ParentId", + table: "ObjScenarioText", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjSnow_Id", + table: "ObjSnow", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjSnow_ParentId", + table: "ObjSnow", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjSound_Id", + table: "ObjSound", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjSound_ParentId", + table: "ObjSound", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjSteam_Id", + table: "ObjSteam", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjSteam_ParentId", + table: "ObjSteam", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjStreetLight_Id", + table: "ObjStreetLight", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjStreetLight_ParentId", + table: "ObjStreetLight", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTownNames_Id", + table: "ObjTownNames", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTownNames_ParentId", + table: "ObjTownNames", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrack_Id", + table: "ObjTrack", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrack_ParentId", + table: "ObjTrack", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackExtra_Id", + table: "ObjTrackExtra", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackExtra_ParentId", + table: "ObjTrackExtra", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackSignal_Id", + table: "ObjTrackSignal", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackSignal_ParentId", + table: "ObjTrackSignal", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackStation_Id", + table: "ObjTrackStation", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackStation_ParentId", + table: "ObjTrackStation", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTree_Id", + table: "ObjTree", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTree_ParentId", + table: "ObjTree", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTunnel_Id", + table: "ObjTunnel", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTunnel_ParentId", + table: "ObjTunnel", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjVehicle_Id", + table: "ObjVehicle", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjVehicle_ParentId", + table: "ObjVehicle", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjWall_Id", + table: "ObjWall", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjWall_ParentId", + table: "ObjWall", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjWater_Id", + table: "ObjWater", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjWater_ParentId", + table: "ObjWater", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_SC5FilePacks_LicenceId", + table: "SC5FilePacks", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_SC5FilePacks_Name", + table: "SC5FilePacks", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_SC5Files_LicenceId", + table: "SC5Files", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_SC5Files_Name", + table: "SC5Files", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_StringTable_ObjectId", + table: "StringTable", + column: "ObjectId"); + + migrationBuilder.CreateIndex( + name: "IX_StringTable_Text", + table: "StringTable", + column: "Text"); + + migrationBuilder.CreateIndex( + name: "IX_Tags_Name", + table: "Tags", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblObject_ObjectsId", + table: "TblAuthorTblObject", + column: "ObjectsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblObjectPack_ObjectPacksId", + table: "TblAuthorTblObjectPack", + column: "ObjectPacksId"); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblSC5File_SC5FilesId", + table: "TblAuthorTblSC5File", + column: "SC5FilesId"); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblSC5FilePack_SC5FilePacksId", + table: "TblAuthorTblSC5FilePack", + column: "SC5FilePacksId"); + + migrationBuilder.CreateIndex( + name: "IX_TblObjectPackTblTag_TagsId", + table: "TblObjectPackTblTag", + column: "TagsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblObjectTblObjectPack_ObjectsId", + table: "TblObjectTblObjectPack", + column: "ObjectsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblObjectTblTag_TagsId", + table: "TblObjectTblTag", + column: "TagsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblSC5FilePackTblTag_TagsId", + table: "TblSC5FilePackTblTag", + column: "TagsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblSC5FileTblSC5FilePack_SC5FilesId", + table: "TblSC5FileTblSC5FilePack", + column: "SC5FilesId"); + + migrationBuilder.CreateIndex( + name: "IX_TblSC5FileTblTag_TagsId", + table: "TblSC5FileTblTag", + column: "TagsId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DatObjects"); + + migrationBuilder.DropTable( + name: "ObjAirport"); + + migrationBuilder.DropTable( + name: "ObjBridge"); + + migrationBuilder.DropTable( + name: "ObjBuilding"); + + migrationBuilder.DropTable( + name: "ObjCargo"); + + migrationBuilder.DropTable( + name: "ObjCliffEdge"); + + migrationBuilder.DropTable( + name: "ObjClimate"); + + migrationBuilder.DropTable( + name: "ObjCompetitor"); + + migrationBuilder.DropTable( + name: "ObjCurrency"); + + migrationBuilder.DropTable( + name: "ObjDock"); + + migrationBuilder.DropTable( + name: "ObjectsMissing"); + + migrationBuilder.DropTable( + name: "ObjHillShapes"); + + migrationBuilder.DropTable( + name: "ObjIndustry"); + + migrationBuilder.DropTable( + name: "ObjInterface"); + + migrationBuilder.DropTable( + name: "ObjLand"); + + migrationBuilder.DropTable( + name: "ObjLevelCrossing"); + + migrationBuilder.DropTable( + name: "ObjRegion"); + + migrationBuilder.DropTable( + name: "ObjRoad"); + + migrationBuilder.DropTable( + name: "ObjRoadExtra"); + + migrationBuilder.DropTable( + name: "ObjRoadStation"); + + migrationBuilder.DropTable( + name: "ObjScaffolding"); + + migrationBuilder.DropTable( + name: "ObjScenarioText"); + + migrationBuilder.DropTable( + name: "ObjSnow"); + + migrationBuilder.DropTable( + name: "ObjSound"); + + migrationBuilder.DropTable( + name: "ObjSteam"); + + migrationBuilder.DropTable( + name: "ObjStreetLight"); + + migrationBuilder.DropTable( + name: "ObjTownNames"); + + migrationBuilder.DropTable( + name: "ObjTrack"); + + migrationBuilder.DropTable( + name: "ObjTrackExtra"); + + migrationBuilder.DropTable( + name: "ObjTrackSignal"); + + migrationBuilder.DropTable( + name: "ObjTrackStation"); + + migrationBuilder.DropTable( + name: "ObjTree"); + + migrationBuilder.DropTable( + name: "ObjTunnel"); + + migrationBuilder.DropTable( + name: "ObjVehicle"); + + migrationBuilder.DropTable( + name: "ObjWall"); + + migrationBuilder.DropTable( + name: "ObjWater"); + + migrationBuilder.DropTable( + name: "StringTable"); + + migrationBuilder.DropTable( + name: "TblAuthorTblObject"); + + migrationBuilder.DropTable( + name: "TblAuthorTblObjectPack"); + + migrationBuilder.DropTable( + name: "TblAuthorTblSC5File"); + + migrationBuilder.DropTable( + name: "TblAuthorTblSC5FilePack"); + + migrationBuilder.DropTable( + name: "TblObjectPackTblTag"); + + migrationBuilder.DropTable( + name: "TblObjectTblObjectPack"); + + migrationBuilder.DropTable( + name: "TblObjectTblTag"); + + migrationBuilder.DropTable( + name: "TblSC5FilePackTblTag"); + + migrationBuilder.DropTable( + name: "TblSC5FileTblSC5FilePack"); + + migrationBuilder.DropTable( + name: "TblSC5FileTblTag"); + + migrationBuilder.DropTable( + name: "Authors"); + + migrationBuilder.DropTable( + name: "ObjectPacks"); + + migrationBuilder.DropTable( + name: "Objects"); + + migrationBuilder.DropTable( + name: "SC5FilePacks"); + + migrationBuilder.DropTable( + name: "SC5Files"); + + migrationBuilder.DropTable( + name: "Tags"); + + migrationBuilder.DropTable( + name: "Licences"); + } + } +} diff --git a/Definitions/Migrations/20251228122835_AddTblObjectMissing.Designer.cs b/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.Designer.cs similarity index 89% rename from Definitions/Migrations/20251228122835_AddTblObjectMissing.Designer.cs rename to Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.Designer.cs index c766f8c1..73863d52 100644 --- a/Definitions/Migrations/20251228122835_AddTblObjectMissing.Designer.cs +++ b/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.Designer.cs @@ -1,4 +1,4 @@ -// +// using System; using Definitions.Database; using Microsoft.EntityFrameworkCore; @@ -8,17 +8,17 @@ #nullable disable -namespace Definitions.Database.Migrations +namespace Definitions.Migrations.Loco { [DbContext(typeof(LocoDbContext))] - [Migration("20251228122835_AddTblObjectMissing")] - partial class AddTblObjectMissing + [Migration("20260527120443_AddDatObjectFileName")] + partial class AddDatObjectFileName { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); + modelBuilder.HasAnnotation("ProductVersion", "10.0.8"); modelBuilder.Entity("Definitions.Database.TblAuthor", b => { @@ -51,6 +51,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("TEXT"); + b.Property("FileName") + .HasColumnType("TEXT"); + b.Property("ObjectId") .HasColumnType("INTEGER"); @@ -1675,202 +1678,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.ToTable("Tags"); }); - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - modelBuilder.Entity("TblAuthorTblObject", b => { b.Property("AuthorsId") @@ -2453,66 +2260,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Navigation("Object"); }); - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - modelBuilder.Entity("TblAuthorTblObject", b => { b.HasOne("Definitions.Database.TblAuthor", null) diff --git a/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs b/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs new file mode 100644 index 00000000..d1d533d3 --- /dev/null +++ b/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Definitions.Migrations.Loco +{ + /// + public partial class AddDatObjectFileName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "FileName", + table: "DatObjects", + type: "TEXT", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "FileName", + table: "DatObjects"); + } + } +} diff --git a/Definitions/Migrations/LocoDbModelSnapshot.cs b/Definitions/Migrations/Loco/LocoDbContextModelSnapshot.cs similarity index 89% rename from Definitions/Migrations/LocoDbModelSnapshot.cs rename to Definitions/Migrations/Loco/LocoDbContextModelSnapshot.cs index db9ae8f8..7d54ff06 100644 --- a/Definitions/Migrations/LocoDbModelSnapshot.cs +++ b/Definitions/Migrations/Loco/LocoDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using System; using Definitions.Database; using Microsoft.EntityFrameworkCore; @@ -7,15 +7,15 @@ #nullable disable -namespace Definitions.Database.Migrations +namespace Definitions.Migrations.Loco { [DbContext(typeof(LocoDbContext))] - partial class LocoDbModelSnapshot : ModelSnapshot + partial class LocoDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); + modelBuilder.HasAnnotation("ProductVersion", "10.0.8"); modelBuilder.Entity("Definitions.Database.TblAuthor", b => { @@ -48,6 +48,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("TEXT"); + b.Property("FileName") + .HasColumnType("TEXT"); + b.Property("ObjectId") .HasColumnType("INTEGER"); @@ -1672,202 +1675,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Tags"); }); - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); - - b.Property("AssociatedAuthorId") - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); - - b.Property("LockoutEnd") - .HasColumnType("TEXT"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("PasswordHash") - .HasColumnType("TEXT"); - - b.Property("PhoneNumber") - .HasColumnType("TEXT"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); - - b.Property("SecurityStamp") - .HasColumnType("TEXT"); - - b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("AssociatedAuthorId"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Definitions.Database.TblUserRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("TEXT"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClaimType") - .HasColumnType("TEXT"); - - b.Property("ClaimValue") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("ProviderKey") - .HasColumnType("TEXT"); - - b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); - - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("RoleId") - .HasColumnType("INTEGER"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("INTEGER"); - - b.Property("LoginProvider") - .HasColumnType("TEXT"); - - b.Property("Name") - .HasColumnType("TEXT"); - - b.Property("Value") - .HasColumnType("TEXT"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - modelBuilder.Entity("TblAuthorTblObject", b => { b.Property("AuthorsId") @@ -2450,66 +2257,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Object"); }); - modelBuilder.Entity("Definitions.Database.TblUser", b => - { - b.HasOne("Definitions.Database.TblAuthor", "AssociatedAuthor") - .WithMany() - .HasForeignKey("AssociatedAuthorId"); - - b.Navigation("AssociatedAuthor"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Definitions.Database.TblUserRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Definitions.Database.TblUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - modelBuilder.Entity("TblAuthorTblObject", b => { b.HasOne("Definitions.Database.TblAuthor", null) diff --git a/Definitions/ObjectIndex.cs b/Definitions/ObjectIndex.cs new file mode 100644 index 00000000..98d9450c --- /dev/null +++ b/Definitions/ObjectIndex.cs @@ -0,0 +1,62 @@ +using System.Collections.ObjectModel; +using Definitions.Database; +using Microsoft.EntityFrameworkCore; + +namespace Definitions; + +// Thin in-memory container of ObjectIndexEntry projections. The legacy +// JSON-on-disk implementation has been removed; the local client builds this +// from the SQLite DB (LocalObjectIndexService) and the server builds it from +// its own DB. Kept as a class so existing UI bindings on Objects remain valid. +public class ObjectIndex +{ + public ObservableCollection Objects { get; init; } = []; + + public ObjectIndex() + { } + + public ObjectIndex(IEnumerable objects) + => Objects = [.. objects]; + + public bool TryFind((string datName, uint datChecksum) key, out ObjectIndexEntry? entry) + { + entry = Objects.FirstOrDefault(x => x.DisplayName == key.datName && x.DatChecksum == key.datChecksum); + return entry != null; + } + + public bool TryFind(ulong xxHash3, out ObjectIndexEntry? entry) + { + entry = Objects.FirstOrDefault(x => x.xxHash3 == xxHash3); + return entry != null; + } + + public void Delete(Func predicate) + { + foreach (var d in Objects.Where(predicate).ToList()) + { + _ = Objects.Remove(d); + } + } + + // Synchronous projection from a LocoDbContext. Used by tooling that already + // owns a context (DatabaseTools, DataQuery, tests). UI code should prefer + // LocalObjectIndexService.BuildObjectIndexAsync(). + public static ObjectIndex FromDb(LocoDbContext db) + { + var rows = db.DatObjects.AsNoTracking() + .Include(d => d.Object) + .Select(d => new ObjectIndexEntry( + d.DatName, + d.FileName, + d.Object.Id, + d.DatChecksum, + d.xxHash3, + d.Object.ObjectType, + d.Object.ObjectSource, + d.Object.CreatedDate, + d.Object.ModifiedDate, + d.Object.VehicleType)) + .ToList(); + return new ObjectIndex(rows); + } +} diff --git a/Definitions/ObjectIndexEntry.cs b/Definitions/ObjectIndexEntry.cs new file mode 100644 index 00000000..82796bd9 --- /dev/null +++ b/Definitions/ObjectIndexEntry.cs @@ -0,0 +1,22 @@ +using Definitions.ObjectModels.Objects.Vehicle; +using Definitions.ObjectModels.Types; + +namespace Definitions; + +// Flat projection of TblObject + TblDatObject used by the UI and various tooling. +// Built either from the local DB (LocalObjectIndexService.BuildObjectIndexAsync) +// or from server-side DTOs (online browse). +public record ObjectIndexEntry( + string DisplayName, + string? FileName, // local-only: path under the user's object folder + UniqueObjectId? Id, // online-only: server-assigned id + uint32_t? DatChecksum, + ulong? xxHash3, + ObjectType ObjectType, + ObjectSource ObjectSource, + DateOnly? CreatedDate, + DateOnly? ModifiedDate, + VehicleType? VehicleType = null) +{ + public string SimpleText => $"{DisplayName} | {FileName}"; +} diff --git a/Gui/App.axaml.cs b/Gui/App.axaml.cs index 745dcd06..1767afb7 100644 --- a/Gui/App.axaml.cs +++ b/Gui/App.axaml.cs @@ -16,9 +16,24 @@ public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { + var mainVm = new MainWindowViewModel(); desktop.MainWindow = new MainWindow { - DataContext = new MainWindowViewModel(), + DataContext = mainVm, + }; + + // Ensure the embedded ObjectService (if started) and any other context-owned + // resources are cleaned up when the application is shutting down. + desktop.ShutdownRequested += (_, _) => + { + try + { + mainVm.EditorContext.DisposeAsync().AsTask().GetAwaiter().GetResult(); + } + catch + { + // best-effort: never throw from shutdown + } }; } diff --git a/Gui/Converters/EnumToMaterialIconConverter.cs b/Gui/Converters/EnumToMaterialIconConverter.cs index 906b2a03..d7ea816d 100644 --- a/Gui/Converters/EnumToMaterialIconConverter.cs +++ b/Gui/Converters/EnumToMaterialIconConverter.cs @@ -3,7 +3,7 @@ using Definitions.ObjectModels.Objects.Vehicle; using Definitions.ObjectModels.Types; using Gui.Models; -using Index; +using Definitions; using System; using System.Collections.Generic; using System.Globalization; diff --git a/Gui/EditorSettings.cs b/Gui/EditorSettings.cs index d480a633..0ee5a5d6 100644 --- a/Gui/EditorSettings.cs +++ b/Gui/EditorSettings.cs @@ -1,9 +1,9 @@ using Common.Json; +using Definitions.Database; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.IO; -using System.Text; using System.Text.Json; using System.Text.Json.Serialization; @@ -37,13 +37,27 @@ public HashSet ObjDataDirectories public string ServerAddressHttp { get; set; } = "http://openloco.leftofzen.dev/"; public string ServerAddressHttps { get; set; } = "https://openloco.leftofzen.dev/"; - //public string ServerEmail { get; set; } - //public string ServerPassword { get; set; } + // The GUI always hosts its own in-process ObjectService instance and the + // ObjectServiceClient points at it; the remote ServerAddress* values are only + // used as a fallback if the embedded host fails to start. + // See Gui/Services/EmbeddedObjectServiceHost.cs. + + // 0 = pick an ephemeral port; any non-zero value is used as the fixed loopback port. + public int LocalServerPort { get; set; } + + // Root folder on disk that the embedded ObjectService serves .dat files from. + // Auto-populated under %APPDATA% on first run if left empty. + public string LocalServerObjectsRoot { get; set; } = string.Empty; + + // Path to the palette PNG used by the embedded ObjectService for rendering. + // Auto-extracted from the bundled Avalonia asset on first run if left empty. + public string LocalServerPaletteMapFile { get; set; } = string.Empty; - public string ObjectIndicesFolder { get; set; } = string.Empty; public string DownloadFolder { get; set; } = string.Empty; public string CacheFolder { get; set; } = string.Empty; + public string DatabaseFile { get; set; } = LocoDbContext.DefaultDb; + public string LocomotionSteamObjDataFolder { get; set; } = string.Empty; public string LocomotionGoGObjDataFolder { get; set; } = string.Empty; public string AppDataObjDataFolder { get; set; } = string.Empty; @@ -59,16 +73,6 @@ public string GetGameObjDataFolder(GameObjDataFolder folder) _ => throw new NotImplementedException(), }; - [JsonIgnore] - public string IndexFileName - { - get - { - var filename = Convert.ToBase64String(Encoding.UTF8.GetBytes(ObjDataDirectory)); - return Path.Combine(ObjectIndicesFolder, $"{filename}.json"); - } - } - [JsonIgnore] public const string DefaultFileName = "settings.json"; // "settings-dev.json" for dev, "settings.json" for prod @@ -164,12 +168,6 @@ public bool Validate(ILogger logger) return false; } - if (!string.IsNullOrEmpty(ObjectIndicesFolder) && !Directory.Exists(ObjectIndicesFolder)) - { - logger.LogWarning("Invalid settings file: Object index folder \"{ObjectIndicesFolder}\" does not exist", ObjectIndicesFolder); - return false; - } - return true; } } diff --git a/Gui/Gui.csproj b/Gui/Gui.csproj index 782b79ff..60bce54b 100644 --- a/Gui/Gui.csproj +++ b/Gui/Gui.csproj @@ -68,9 +68,11 @@ + - + + diff --git a/Gui/Models/FileLocation.cs b/Gui/Models/FileLocation.cs deleted file mode 100644 index e9258fe4..00000000 --- a/Gui/Models/FileLocation.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Gui.Models; - -[Flags] -public enum FileLocation -{ - Local, - Online, -} diff --git a/Gui/Models/FileSystemItems.cs b/Gui/Models/FileSystemItems.cs index 85e8d178..8f173685 100644 --- a/Gui/Models/FileSystemItems.cs +++ b/Gui/Models/FileSystemItems.cs @@ -3,7 +3,7 @@ using System; using System.Collections.ObjectModel; using System.Text.Json.Serialization; -using FileLocationKind = Gui.Models.FileLocation; +using FileLocationKind = Definitions.FileLocation; using OnlineApiEndpointGroupKind = Gui.Models.OnlineApiEndpointGroup; namespace Gui.Models; diff --git a/Gui/Models/ObjectEditorContext.cs b/Gui/Models/ObjectEditorContext.cs index e9423f01..9569bcc4 100644 --- a/Gui/Models/ObjectEditorContext.cs +++ b/Gui/Models/ObjectEditorContext.cs @@ -1,14 +1,17 @@ +using Definitions; +using Avalonia.Platform; using Avalonia.Threading; using Common; using Common.Logging; using Dat.Converters; using Dat.FileParsing; +using Dat.Services; using Dat.Types; +using Definitions.Database; using Definitions.DTO; using Definitions.ObjectModels; using Definitions.ObjectModels.Types; using DynamicData; -using Index; using Microsoft.Extensions.Logging; using SixLabors.ImageSharp; using System; @@ -17,8 +20,11 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; +using System.Net; +using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; +using Gui.Services; namespace Gui.Models; @@ -62,6 +68,20 @@ public class ObjectEditorContext : IDisposable, IAsyncDisposable public ObjectServiceModel ObjectServiceModel { get; init; } + // Always non-null. Reflects the lifecycle of the in-process ObjectService - the GUI's + // only backend. The remote ServerAddress* settings are only used as a fallback if the + // embedded host fails to start (e.g. paths are misconfigured and unrecoverable). + public Gui.Services.EmbeddedObjectServiceHost LocalServerHost { get; } + + // Always non-null. Background poller that surfaces the reachability of the configured + // remote master ObjectService, independently of the embedded local host. + public Gui.Services.RemoteServerMonitor RemoteServerMonitor { get; } + + // Fires every time the embedded host transitions to Running. Consumers (e.g. post-startup + // re-indexers) can subscribe to be notified that the local backend is live without + // having to poll. + public event EventHandler? LocalServerStarted; + readonly ConcurrentQueue logQueue = new(); readonly SemaphoreSlim logFileLock = new(1, 1); // Allow only 1 concurrent write @@ -76,12 +96,230 @@ public ObjectEditorContext() // settings must be loaded or else the rest of the app cannot start ArgumentNullException.ThrowIfNull(Settings); - Settings.ObjectIndicesFolder = InitialiseDirectory(Settings.ObjectIndicesFolder, "objectIndices"); Settings.CacheFolder = InitialiseDirectory(Settings.CacheFolder, "cache"); Settings.DownloadFolder = InitialiseDirectory(Settings.DownloadFolder, "downloads"); - ObjectServiceClient = new(Settings, Logger); + LocalServerHost = new Gui.Services.EmbeddedObjectServiceHost(Logger); + + // Make sure the host has a usable objects-root folder and palette file to point + // at - even if the user hasn't filled them in. + EnsureLocalServerDefaults(); + + // Resolve the loopback URL up front so ObjectServiceClient can be wired to the + // local host before Kestrel has finished binding. The actual server start is then + // fire-and-forget on a background task; the client will simply see failed requests + // until the host transitions to Running. + var localBaseAddress = PrepareLocalServerUri(); + + ObjectServiceClient = new(Settings, Logger, localBaseAddress); ObjectServiceModel = new ObjectServiceModel(ObjectServiceClient, Logger); + + if (localBaseAddress is not null) + { + _ = Task.Run(() => StartLocalServerAsync(localBaseAddress)); + } + + // When the embedded ObjectService finishes coming up, scan the active user folder + // (if any) so a freshly-created local DB gets populated without manual intervention. + LocalServerStarted += (_, _) => _ = Task.Run(ReindexConfiguredFoldersAsync); + + RemoteServerMonitor = new Gui.Services.RemoteServerMonitor(Logger); + RemoteServerMonitor.Configure(GetRemoteServerUri()); + } + + Uri? GetRemoteServerUri() + { + var address = Settings.UseHttps ? Settings.ServerAddressHttps : Settings.ServerAddressHttp; + return Uri.TryCreate(address, UriKind.Absolute, out var uri) ? uri : null; + } + + // Fills in sensible defaults for the embedded ObjectService when the user hasn't + // configured paths yet. Lets the feature work out-of-the-box from a clean settings file: + // the objects root lives under %APPDATA%/.../LocalServer and the palette is extracted + // from the bundled Avalonia asset on first run. + void EnsureLocalServerDefaults() + { + var changed = false; + + if (string.IsNullOrWhiteSpace(Settings.LocalServerObjectsRoot)) + { + Settings.LocalServerObjectsRoot = Path.Combine(ProgramDataPath, "LocalServer"); + Logger.LogInformation("Defaulted LocalServerObjectsRoot to \"{Path}\"", Settings.LocalServerObjectsRoot); + changed = true; + } + + if (string.IsNullOrWhiteSpace(Settings.LocalServerPaletteMapFile)) + { + var palettePath = Path.Combine(ProgramDataPath, "palette.png"); + if (!File.Exists(palettePath)) + { + try + { + _ = Directory.CreateDirectory(ProgramDataPath); + using var src = AssetLoader.Open(new Uri("avares://ObjectEditor/Assets/palette.png")); + using var dst = File.Create(palettePath); + src.CopyTo(dst); + Logger.LogInformation("Extracted bundled palette.png to \"{Path}\"", palettePath); + } + catch (Exception ex) + { + Logger.LogWarning(ex, "Failed to extract bundled palette.png; the local server will fail to start until LocalServerPaletteMapFile is set manually."); + return; + } + } + + Settings.LocalServerPaletteMapFile = palettePath; + Logger.LogInformation("Defaulted LocalServerPaletteMapFile to \"{Path}\"", palettePath); + changed = true; + } + + if (changed) + { + Settings.Save(SettingsFile, Logger); + } + } + + // Best-effort reindex of the user's configured obj-data folder(s) into the local DB. + // Runs on the thread pool, swallows individual-folder errors so one bad path can't + // stall the whole pass. + async Task ReindexConfiguredFoldersAsync() { + try + { + var folders = new List(); + if (!string.IsNullOrWhiteSpace(Settings.ObjDataDirectory)) + { + folders.Add(Settings.ObjDataDirectory); + } + + if (Settings.ObjDataDirectories is { Count: > 0 }) + { + foreach (var dir in Settings.ObjDataDirectories) + { + if (!folders.Contains(dir, StringComparer.OrdinalIgnoreCase)) + { + folders.Add(dir); + } + } + } + + if (folders.Count == 0) + { + Logger.LogInformation("No user obj-data folders configured; skipping post-startup reindex."); + return; + } + + // Note: LoadObjDirectoryAsync uses a single shared indexerTask + semaphore, so + // calls are serialised. RebuildFromFolderAsync wipes the DB between calls, so + // for now we only fully reindex the *first* (active) folder and log the rest. + var primary = folders[0]; + if (!Directory.Exists(primary)) + { + Logger.LogWarning("Configured obj-data folder does not exist: {Directory}", primary); + return; + } + + Logger.LogInformation("Reindexing user obj-data folder into local DB: {Directory}", primary); + var progress = new Progress(); + await LoadObjDirectoryAsync(primary, progress, useExistingIndex: true); + + if (folders.Count > 1) + { + Logger.LogInformation("Additional configured folders not auto-reindexed (only the active folder is currently scanned): {Folders}", string.Join(", ", folders.Skip(1))); + } + } + catch (Exception ex) + { + Logger.LogError(ex, "Error during post-startup reindex of user folders."); + } + } + + // Decides whether the embedded server should be started and, if so, returns the URL it + // will bind to. The port is reserved synchronously so the caller knows the final URL + // before Kestrel starts. Returns null only when the required paths cannot be resolved. + Uri? PrepareLocalServerUri() + { + if (string.IsNullOrWhiteSpace(Settings.LocalServerObjectsRoot) + || string.IsNullOrWhiteSpace(Settings.LocalServerPaletteMapFile) + || string.IsNullOrWhiteSpace(Settings.DatabaseFile)) + { + Logger.LogWarning("One or more of LocalServerObjectsRoot, LocalServerPaletteMapFile, DatabaseFile is empty. Local server will not start; falling back to remote server."); + return null; + } + + var port = Settings.LocalServerPort > 0 ? Settings.LocalServerPort : ReserveLoopbackPort(); + return new Uri($"http://127.0.0.1:{port}/"); + } + + // Briefly opens a TcpListener on port 0 to ask the OS for a free loopback port. There + // is a small race window between Stop() and Kestrel binding, but for localhost-only + // startup it's acceptable. + static int ReserveLoopbackPort() + { + var listener = new TcpListener(IPAddress.Loopback, 0); + listener.Start(); + try + { + return ((IPEndPoint)listener.LocalEndpoint).Port; + } + finally + { + listener.Stop(); + } + } + + async Task StartLocalServerAsync(Uri targetUri) + { + try + { + var options = new ObjectService.Hosting.ObjectServiceHostOptions + { + RootFolder = Settings.LocalServerObjectsRoot, + DatabaseFile = Settings.DatabaseFile, + PaletteMapFile = Settings.LocalServerPaletteMapFile, + HttpUrl = targetUri.ToString().TrimEnd('/'), + JwtKey = EmbeddedObjectServiceHost.GenerateEphemeralJwtKey(), + IsServer = false, + }; + await LocalServerHost.StartAsync(options); + + if (LocalServerHost.IsRunning) + { + LocalServerStarted?.Invoke(this, EventArgs.Empty); + } + } + catch (Exception ex) + { + Logger.LogError(ex, "Failed to start embedded ObjectService; falling back to remote server for any subsequent calls."); + } + } + + // Stops the currently-running embedded host (if any), recomputes the target URL from + // the current settings, re-targets the ObjectServiceClient, and (if applicable) kicks + // off a fresh background start. Safe to call from the UI thread. + public async Task RestartLocalServerAsync() + { + try + { + await LocalServerHost.StopAsync(); + } + catch (Exception ex) + { + Logger.LogError(ex, "Error while stopping embedded ObjectService during restart."); + } + + // Pick up any path defaults that may have been cleared by the user. + EnsureLocalServerDefaults(); + + var newBaseAddress = PrepareLocalServerUri(); + ObjectServiceClient.RetargetBaseAddress(newBaseAddress); + + // Remote address may have changed via settings; re-point the monitor at the new URI. + RemoteServerMonitor.Configure(GetRemoteServerUri()); + + if (newBaseAddress is not null) + { + _ = Task.Run(() => StartLocalServerAsync(newBaseAddress)); + } } public async Task LogAsync(LogLine log) @@ -414,82 +652,36 @@ async Task LoadObjDirectoryAsyncCore(string directory, IProgress progress Settings.ObjDataDirectory = directory; Settings.Save(SettingsFile, Logger); - if (useExistingIndex && File.Exists(Settings.IndexFileName)) - { - var exception = false; + var indexService = new LocalObjectIndexService( + () => LocoDbContext.GetDbFromFile(Settings.DatabaseFile) + ?? throw new FileNotFoundException($"Database file not found: {Settings.DatabaseFile}"), + Logger); - try - { - var index = await ObjectIndex.LoadIndexAsync(Settings.IndexFileName).ConfigureAwait(false); - ArgumentNullException.ThrowIfNull(index, nameof(index)); - ObjectIndex = index; - Logger.LogInformation("Loaded index for {Directory} with {Count} objects.", directory, ObjectIndex.Objects.Count); - } - catch (Exception ex) - { - Logger.LogError(ex, "Failed to load index from \"{IndexFileName}\"", Settings.IndexFileName); - exception = true; - } - - if (exception || ObjectIndex?.Objects == null || ObjectIndex.Objects.Any(x => string.IsNullOrEmpty(x.FileName) || (x is ObjectIndexEntry xx && string.IsNullOrEmpty(xx.DisplayName)))) - { - Logger.LogWarning("Index file format has changed or otherwise appears to be malformed - recreating now."); - await RecreateIndex(directory, progress).ConfigureAwait(false); - return; - } + if (useExistingIndex) + { + ObjectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); + Logger.LogInformation("Loaded index for {Directory} with {Count} objects from {Db}.", directory, ObjectIndex.Objects.Count, Settings.DatabaseFile); - var objectIndexFilenames = ObjectIndex.Objects.Select(x => x.FileName); + // Reconcile against on-disk files; rescan deltas. + var indexed = ObjectIndex.Objects.Select(x => x.FileName).Where(x => !string.IsNullOrEmpty(x)).Cast().ToHashSet(); var allFiles = SawyerStreamUtils.GetDatFilesInDirectory(directory).ToArray(); - - var a = objectIndexFilenames.Except(allFiles); - var b = allFiles.Except(objectIndexFilenames); - if (a.Any() || b.Any()) + var added = allFiles.Except(indexed).ToList(); + var removed = indexed.Except(allFiles).ToList(); + if (added.Count > 0 || removed.Count > 0) { - Logger.LogWarning("Index file and files on disk don't match; re-indexing those files and updating the index now."); - Logger.LogWarning("Objects in index but not on disk: {Value}", string.Join(',', a)); - Logger.LogWarning("Objects on disk but not in index: {Value}", string.Join(',', b)); - await UpdateIndex(directory, progress, a.Concat(b).Where(x => x != null)!).ConfigureAwait(false); + Logger.LogWarning("Index and files on disk don't match; rebuilding from folder."); + Logger.LogWarning("Objects in index but not on disk: {Value}", string.Join(',', removed)); + Logger.LogWarning("Objects on disk but not in index: {Value}", string.Join(',', added)); + await indexService.RebuildFromFolderAsync(directory, progress).ConfigureAwait(false); + ObjectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); } } else { - await RecreateIndex(directory, progress).ConfigureAwait(false); - } - - async Task UpdateIndex(string directory, IProgress progress, IEnumerable filesToAdd) - { - Logger.LogInformation("Updating index file for {Directory}", directory); - _ = ObjectIndex.UpdateIndex(directory, Logger, filesToAdd, progress); - - if (string.IsNullOrEmpty(Settings.IndexFileName)) - { - Logger.LogError("Index filename was null or empty."); - return; - } - - await ObjectIndex.SaveIndexAsync(Settings.IndexFileName).ConfigureAwait(false); - Logger.LogInformation("Index was saved to {IndexFileName}", Settings.IndexFileName); - } - - async Task RecreateIndex(string directory, IProgress progress) - { - Logger.LogInformation("Recreating index file for {Directory}", directory); - ObjectIndex = await ObjectIndex.CreateIndexAsync(directory, Logger, progress).ConfigureAwait(false); - - if (ObjectIndex == null) - { - Logger.LogError("Index was unable to be created."); - return; - } - - if (string.IsNullOrEmpty(Settings.IndexFileName)) - { - Logger.LogError("Index filename was null or empty."); - return; - } - - await ObjectIndex.SaveIndexAsync(Settings.IndexFileName).ConfigureAwait(false); - Logger.LogInformation("New index was saved to {IndexFileName}", Settings.IndexFileName); + Logger.LogInformation("Rebuilding index for {Directory}", directory); + await indexService.RebuildFromFolderAsync(directory, progress).ConfigureAwait(false); + ObjectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); + Logger.LogInformation("New index has {Count} objects.", ObjectIndex.Objects.Count); } } @@ -548,6 +740,26 @@ public async Task UploadDatToServer(ObjectIndexEntry dat) public async Task CloseAsync() { + // Stop the embedded ObjectService (if running) before we tear down logging, + // so any shutdown logs from Kestrel still have somewhere to go. + try + { + await LocalServerHost.DisposeAsync(); + } + catch (Exception ex) + { + Logger.LogError(ex, "Error while stopping embedded ObjectService."); + } + + try + { + await RemoteServerMonitor.DisposeAsync(); + } + catch (Exception ex) + { + Logger.LogError(ex, "Error while stopping remote server monitor."); + } + // Wait for any pending writes to complete. await logFileLock.WaitAsync(); // Acquire the semaphore _ = logFileLock.Release(); // Release it immediately after. This is just to wait. diff --git a/Gui/Models/ObjectServiceModel.cs b/Gui/Models/ObjectServiceModel.cs index 86d110c6..2efee7ab 100644 --- a/Gui/Models/ObjectServiceModel.cs +++ b/Gui/Models/ObjectServiceModel.cs @@ -1,5 +1,6 @@ using Avalonia.Threading; using Definitions.DTO; +using Gui.Services; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Gui/ObjectServiceClient.cs b/Gui/ObjectServiceClient.cs index 5f383bfc..bf22ffe7 100644 --- a/Gui/ObjectServiceClient.cs +++ b/Gui/ObjectServiceClient.cs @@ -10,36 +10,38 @@ namespace Gui; -//public class LocalUser(string Email, string Password) -//{ -// public string Email { get; } = Email; -// public string Password { get; } = Password; -// public string UserName { get; set; } // set when user logs in -// public TblAuthor? AssociatedAuthor { get; set; } -//} - public class ObjectServiceClient { - //public LocalUser LocoUser { get; set; } - public HttpClient WebClient { get; } public ILogger Logger { get; } = null!; public CookieContainer CookieContainer { get; set; } - public ObjectServiceClient(EditorSettings settings, ILogger logger) + readonly EditorSettings settings; + + public ObjectServiceClient(EditorSettings settings, ILogger logger, Uri? baseAddressOverride = null) { + this.settings = settings; Logger = logger; CookieContainer = new CookieContainer(); var handler = new HttpClientHandler() { CookieContainer = CookieContainer }; WebClient = new HttpClient(handler); - var serverAddress = settings.UseHttps - ? settings.ServerAddressHttps - : settings.ServerAddressHttp; + // baseAddressOverride wins when supplied (eg. an in-process EmbeddedObjectServiceHost). + // Otherwise fall back to the configured remote server address. + Uri? serverUri = baseAddressOverride; + string? serverAddress = baseAddressOverride?.ToString(); - if (Uri.TryCreate(serverAddress, new(), out var serverUri)) + if (serverUri is null) + { + serverAddress = settings.UseHttps + ? settings.ServerAddressHttps + : settings.ServerAddressHttp; + _ = Uri.TryCreate(serverAddress, UriKind.Absolute, out serverUri); + } + + if (serverUri is not null) { WebClient.BaseAddress = serverUri; @@ -52,11 +54,31 @@ public ObjectServiceClient(EditorSettings settings, ILogger logger) { Logger.LogError("Unable to parse object service address \"{ServerAddress}\". Online functionality will not work until the address is corrected and the editor is restarted.", serverAddress); } - - //LocoUser = new LocalUser(settings.ServerEmail, settings.ServerPassword); } - //public async Task + // Used when the embedded ObjectService is started or restarted after construction (eg. + // hot-reapply after settings change). Pass null to fall back to the configured remote + // server address from EditorSettings. + public void RetargetBaseAddress(Uri? newBaseAddress) + { + if (newBaseAddress is not null) + { + WebClient.BaseAddress = newBaseAddress; + Logger.LogInformation("Object service client retargeted to \"{ServerUri}\"", newBaseAddress); + return; + } + + var serverAddress = settings.UseHttps ? settings.ServerAddressHttps : settings.ServerAddressHttp; + if (Uri.TryCreate(serverAddress, UriKind.Absolute, out var remoteUri)) + { + WebClient.BaseAddress = remoteUri; + Logger.LogInformation("Object service client reverted to remote address \"{ServerUri}\"", remoteUri); + } + else + { + Logger.LogWarning("Object service client could not revert to remote address; \"{ServerAddress}\" is not a valid URI.", serverAddress); + } + } public async Task> GetListAsync(ApiEndpointGroup endpointGroup) => await Client.GetListAsync(WebClient, endpointGroup, Logger); diff --git a/Gui/Services/EmbeddedHostState.cs b/Gui/Services/EmbeddedHostState.cs new file mode 100644 index 00000000..5f19a6bf --- /dev/null +++ b/Gui/Services/EmbeddedHostState.cs @@ -0,0 +1,20 @@ +namespace Gui.Services; + +public enum EmbeddedHostState +{ + // Initial state before StartAsync has been called, or after construction with no + // runnable configuration. The host is not yet trying to start. + Disabled, + + // Bootstrap / Kestrel startup is in progress. + Starting, + + // Kestrel is bound and the health probe succeeded. + Running, + + // Startup or runtime error - see StatusMessage for details. + Failed, + + // Host was running and has been stopped (cleanly). + Stopped, +} diff --git a/Gui/Services/EmbeddedObjectServiceHost.cs b/Gui/Services/EmbeddedObjectServiceHost.cs new file mode 100644 index 00000000..439ce8e2 --- /dev/null +++ b/Gui/Services/EmbeddedObjectServiceHost.cs @@ -0,0 +1,186 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting.Server; +using Microsoft.AspNetCore.Hosting.Server.Features; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using ObjectService.Hosting; +using ReactiveUI; +using ReactiveUI.Fody.Helpers; +using System; +using System.Linq; +using System.Net.Http; +using System.Security.Cryptography; +using System.Threading; +using System.Threading.Tasks; + +namespace Gui.Services; + +// Owns the lifetime of an in-process ObjectService web application. This is the GUI's +// "local backend": rather than talking to a remote server, the editor can spin up its own +// instance pointing at the user's local objects folder + database, and the existing +// ObjectServiceClient can target it via the resolved BaseAddress. +public sealed class EmbeddedObjectServiceHost : ReactiveObject, IAsyncDisposable +{ + readonly ILogger logger; + readonly SemaphoreSlim lifecycleLock = new(1, 1); + WebApplication? app; + + [Reactive] + public EmbeddedHostState State { get; private set; } = EmbeddedHostState.Disabled; + + [Reactive] + public string? StatusMessage { get; private set; } + + [Reactive] + public Uri? BaseAddress { get; private set; } + + public bool IsRunning => State == EmbeddedHostState.Running; + + public EmbeddedObjectServiceHost(ILogger logger) + { + this.logger = logger; + } + + public async Task StartAsync(ObjectServiceHostOptions options, CancellationToken cancellationToken = default) + { + await lifecycleLock.WaitAsync(cancellationToken); + try + { + if (app is not null) + { + throw new InvalidOperationException("Embedded ObjectService host is already running."); + } + + State = EmbeddedHostState.Starting; + StatusMessage = "Bootstrapping folders and database..."; + + try + { + await ObjectServiceHost.BootstrapAsync(options, cancellationToken); + } + catch (Exception ex) + { + logger.LogError(ex, "Embedded ObjectService bootstrap failed."); + State = EmbeddedHostState.Failed; + StatusMessage = $"Bootstrap failed: {ex.Message}"; + throw; + } + + var builder = WebApplication.CreateBuilder(); + + // Suppress noisy console output from the embedded host - the GUI owns presentation. + builder.Logging.ClearProviders(); + + ObjectServiceHost.ApplyOptionsToConfiguration(builder, options); + ObjectServiceHost.ConfigureBuilder(builder); + + app = builder.Build(); + ObjectServiceHost.Configure(app); + + StatusMessage = "Starting Kestrel..."; + + try + { + await app.StartAsync(cancellationToken); + } + catch (Exception ex) + { + logger.LogError(ex, "Embedded ObjectService failed to start Kestrel."); + State = EmbeddedHostState.Failed; + StatusMessage = $"Kestrel start failed: {ex.Message}"; + await app.DisposeAsync(); + app = null; + throw; + } + + // Resolve the actual bound address (handles the ":0" ephemeral-port case). + var addresses = app.Services.GetRequiredService().Features.Get()?.Addresses; + var resolved = addresses?.FirstOrDefault(); + if (!string.IsNullOrWhiteSpace(resolved) && Uri.TryCreate(resolved, UriKind.Absolute, out var uri)) + { + BaseAddress = uri; + logger.LogInformation("Embedded ObjectService listening on {BaseAddress}", uri); + + StatusMessage = "Waiting for health check..."; + await WaitForReadyAsync(uri, cancellationToken); + + State = EmbeddedHostState.Running; + StatusMessage = $"Running at {uri}"; + } + else + { + logger.LogWarning("Embedded ObjectService started but no bound address could be resolved."); + State = EmbeddedHostState.Failed; + StatusMessage = "Started but could not resolve bound address."; + } + } + finally + { + _ = lifecycleLock.Release(); + } + } + + async Task WaitForReadyAsync(Uri baseAddress, CancellationToken cancellationToken) + { + using var probe = new HttpClient { BaseAddress = baseAddress, Timeout = TimeSpan.FromSeconds(2) }; + var deadline = DateTime.UtcNow + TimeSpan.FromSeconds(10); + while (DateTime.UtcNow < deadline) + { + try + { + using var response = await probe.GetAsync("/health", cancellationToken); + if (response.IsSuccessStatusCode) + { + return; + } + } + catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException) + { + // keep polling + } + + await Task.Delay(TimeSpan.FromMilliseconds(100), cancellationToken); + } + + logger.LogWarning("Embedded ObjectService did not report healthy within the readiness window; continuing anyway."); + } + + public async Task StopAsync(CancellationToken cancellationToken = default) + { + await lifecycleLock.WaitAsync(cancellationToken); + try + { + if (app is null) + { + return; + } + + await app.StopAsync(cancellationToken); + await app.DisposeAsync(); + app = null; + BaseAddress = null; + State = EmbeddedHostState.Stopped; + StatusMessage = "Stopped."; + } + finally + { + _ = lifecycleLock.Release(); + } + } + + public async ValueTask DisposeAsync() + { + await StopAsync(); + lifecycleLock.Dispose(); + } + + // Helper for callers that don't already have a JWT signing key set up. Generates a + // cryptographically random key sized for HS256 (>= 32 bytes). The key only ever lives + // in memory for the lifetime of this process. + public static string GenerateEphemeralJwtKey() + { + Span bytes = stackalloc byte[48]; + RandomNumberGenerator.Fill(bytes); + return Convert.ToBase64String(bytes); + } +} diff --git a/Gui/Services/ObjectServiceClient.cs b/Gui/Services/ObjectServiceClient.cs new file mode 100644 index 00000000..91b85a83 --- /dev/null +++ b/Gui/Services/ObjectServiceClient.cs @@ -0,0 +1,139 @@ +using Common; +using Definitions.DTO; +using Definitions.Web; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; + +namespace Gui.Services; + +public class ObjectServiceClient +{ + public HttpClient WebClient { get; } + + public ILogger Logger { get; } = null!; + + public CookieContainer CookieContainer { get; set; } + + readonly EditorSettings settings; + + public ObjectServiceClient(EditorSettings settings, ILogger logger, Uri? baseAddressOverride = null) + { + this.settings = settings; + Logger = logger; + CookieContainer = new CookieContainer(); + var handler = new HttpClientHandler() { CookieContainer = CookieContainer }; + WebClient = new HttpClient(handler); + + // baseAddressOverride wins when supplied (eg. an in-process EmbeddedObjectServiceHost). + // Otherwise fall back to the configured remote server address. + var serverUri = baseAddressOverride; + var serverAddress = baseAddressOverride?.ToString(); + + if (serverUri is null) + { + serverAddress = settings.UseHttps + ? settings.ServerAddressHttps + : settings.ServerAddressHttp; + _ = Uri.TryCreate(serverAddress, UriKind.Absolute, out serverUri); + } + + if (serverUri is not null) + { + WebClient.BaseAddress = serverUri; + + var currentAppVersion = VersionHelpers.GetCurrentAppVersion(); + WebClient.DefaultRequestHeaders.UserAgent.ParseAdd($"ObjectEditor/{currentAppVersion}"); + + Logger.LogInformation("Successfully registered object service with address \"{ServerUri}\"", serverUri); + } + else + { + Logger.LogError("Unable to parse object service address \"{ServerAddress}\". Online functionality will not work until the address is corrected and the editor is restarted.", serverAddress); + } + } + + // Used when the embedded ObjectService is started or restarted after construction (eg. + // hot-reapply after settings change). Pass null to fall back to the configured remote + // server address from EditorSettings. + public void RetargetBaseAddress(Uri? newBaseAddress) + { + if (newBaseAddress is not null) + { + WebClient.BaseAddress = newBaseAddress; + Logger.LogInformation("Object service client retargeted to \"{ServerUri}\"", newBaseAddress); + return; + } + + var serverAddress = settings.UseHttps ? settings.ServerAddressHttps : settings.ServerAddressHttp; + if (Uri.TryCreate(serverAddress, UriKind.Absolute, out var remoteUri)) + { + WebClient.BaseAddress = remoteUri; + Logger.LogInformation("Object service client reverted to remote address \"{ServerUri}\"", remoteUri); + } + else + { + Logger.LogWarning("Object service client could not revert to remote address; \"{ServerAddress}\" is not a valid URI.", serverAddress); + } + } + + public async Task> GetListAsync(ApiEndpointGroup endpointGroup) + => await Client.GetListAsync(WebClient, endpointGroup, Logger); + + public async Task> GetObjectListAsync() + => await Client.GetObjectListAsync(WebClient, Logger); + + public async Task GetObjectAsync(UniqueObjectId id) + => await Client.GetObjectAsync(WebClient, id, Logger); + + public async Task UpdateObjectAsync(UniqueObjectId id, DtoObjectPostResponse request) + => await Client.UpdateObjectAsync(WebClient, id, request, Logger); + + public async Task GetObjectFileAsync(UniqueObjectId id) + => await Client.GetObjectFileAsync(WebClient, id, Logger); + + public async Task GetScenarioFileAsync(UniqueObjectId id) + => await Client.GetScenarioFileAsync(WebClient, id, Logger); + + public async Task GetSC5FilePackFileAsync(UniqueObjectId id) + => await Client.GetSC5FilePackFileAsync(WebClient, id, Logger); + + public async Task GetObjectPackFileAsync(UniqueObjectId id) + => await Client.GetObjectPackFileAsync(WebClient, id, Logger); + + public async Task UploadDatFileAsync(string filename, byte[] datFileBytes, DateOnly creationDate, DateOnly modifiedDate) + => await Client.UploadDatFileAsync(WebClient, filename, datFileBytes, creationDate, modifiedDate, Logger); + + public async Task AddMissingObjectAsync(DtoObjectMissingPost entry) + => await Client.AddMissingObjectAsync(WebClient, entry, Logger); + + public async Task> GetLicencesAsync() + => await Client.GetLicencesAsync(WebClient, Logger); + + public async Task> GetAuthorsAsync() + => await Client.GetAuthorsAsync(WebClient, Logger); + + public async Task> GetTagsAsync() + => await Client.GetTagsAsync(WebClient, Logger); + + public async Task> GetObjectPacksAsync() + => await Client.GetObjectPacksAsync(WebClient, Logger); + + public async Task?> GetObjectPackAsync(UniqueObjectId id) + => await Client.GetObjectPackAsync(WebClient, id, Logger); + + public async Task> GetScenariosAsync() + => await Client.GetScenariosAsync(WebClient, Logger); + + public async Task> GetSC5FilePacksAsync() + => await Client.GetSC5FilePacksAsync(WebClient, Logger); + + public async Task?> GetSC5FilePackAsync(UniqueObjectId id) + => await Client.GetSC5FilePackAsync(WebClient, id, Logger); + + public async Task> GetMissingObjectsAsync() + => await Client.GetMissingObjectsAsync(WebClient, Logger); +} diff --git a/Gui/Services/RemoteServerMonitor.cs b/Gui/Services/RemoteServerMonitor.cs new file mode 100644 index 00000000..20cb5c86 --- /dev/null +++ b/Gui/Services/RemoteServerMonitor.cs @@ -0,0 +1,138 @@ +using Microsoft.Extensions.Logging; +using ReactiveUI; +using ReactiveUI.Fody.Helpers; +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Gui.Services; + +// Background poller that periodically pings the configured remote master ObjectService +// to surface its reachability in the GUI. Independent of the embedded local host; both +// indicators are expected to be visible simultaneously. +public sealed class RemoteServerMonitor : ReactiveObject, IAsyncDisposable +{ + readonly ILogger logger; + readonly HttpClient probe; + readonly TimeSpan pollInterval; + CancellationTokenSource? loopCts; + Task? loopTask; + + [Reactive] + public RemoteServerState State { get; private set; } = RemoteServerState.Unknown; + + [Reactive] + public string? StatusMessage { get; private set; } + + [Reactive] + public Uri? Address { get; private set; } + + public RemoteServerMonitor(ILogger logger, TimeSpan? pollInterval = null) + { + this.logger = logger; + this.pollInterval = pollInterval ?? TimeSpan.FromSeconds(60); + probe = new HttpClient { Timeout = TimeSpan.FromSeconds(5) }; + } + + // Updates the target address and (re)starts the probe loop. Safe to call from any thread. + public void Configure(Uri? address) + { + Address = address; + StatusMessage = address is null ? "No remote address configured." : null; + + if (address is null) + { + State = RemoteServerState.Unreachable; + return; + } + + Stop(); + loopCts = new CancellationTokenSource(); + loopTask = Task.Run(() => PollLoopAsync(loopCts.Token)); + } + + async Task PollLoopAsync(CancellationToken cancellationToken) + { + // Probe once immediately so the UI doesn't sit on "Unknown" for the full interval. + await ProbeOnceAsync(cancellationToken); + + while (!cancellationToken.IsCancellationRequested) + { + try + { + await Task.Delay(pollInterval, cancellationToken); + } + catch (TaskCanceledException) + { + return; + } + + await ProbeOnceAsync(cancellationToken); + } + } + + async Task ProbeOnceAsync(CancellationToken cancellationToken) + { + var address = Address; + if (address is null) + { + return; + } + + State = RemoteServerState.Checking; + StatusMessage = $"Checking {address}..."; + + try + { + var healthUri = new Uri(address, "/health"); + using var response = await probe.GetAsync(healthUri, cancellationToken); + if (response.IsSuccessStatusCode) + { + State = RemoteServerState.Reachable; + StatusMessage = $"Reachable: {address}"; + } + else + { + State = RemoteServerState.Unreachable; + StatusMessage = $"HTTP {(int)response.StatusCode} from {address}"; + } + } + catch (TaskCanceledException) when (cancellationToken.IsCancellationRequested) + { + // shutdown - swallow + } + catch (Exception ex) + { + State = RemoteServerState.Unreachable; + StatusMessage = $"Unreachable: {ex.Message}"; + logger.LogDebug(ex, "Remote master server probe failed for {Address}", address); + } + } + + void Stop() + { + var cts = loopCts; + loopCts = null; + cts?.Cancel(); + cts?.Dispose(); + } + + public async ValueTask DisposeAsync() + { + Stop(); + if (loopTask is not null) + { + try + { + await loopTask; + } + catch + { + // best-effort shutdown + } + } + + probe.Dispose(); + } +} diff --git a/Gui/Services/RemoteServerState.cs b/Gui/Services/RemoteServerState.cs new file mode 100644 index 00000000..e69f998c --- /dev/null +++ b/Gui/Services/RemoteServerState.cs @@ -0,0 +1,16 @@ +namespace Gui.Services; + +public enum RemoteServerState +{ + // Initial state before the first probe completes. + Unknown, + + // A probe is currently in flight. + Checking, + + // The most recent probe succeeded. + Reachable, + + // The most recent probe failed (timeout, non-success status, DNS error, etc). + Unreachable, +} diff --git a/Gui/ViewModels/EditorSettingsWindowViewModel.cs b/Gui/ViewModels/EditorSettingsWindowViewModel.cs index 188a210c..09f3dde1 100644 --- a/Gui/ViewModels/EditorSettingsWindowViewModel.cs +++ b/Gui/ViewModels/EditorSettingsWindowViewModel.cs @@ -137,4 +137,29 @@ public string ServerAddressHttps } #endregion + + #region Local Server + + [Category("Local Server"), DisplayName("Port"), Description("Local loopback port. Set to 0 to pick an ephemeral port automatically.")] + public int LocalServerPort + { + get => Model.LocalServerPort; + set => Model.LocalServerPort = value; + } + + [Category("Local Server"), DisplayName("Objects root folder"), Description("Filesystem root that the embedded server serves .dat objects from."), PathBrowsable(PathBrowsableType.Directory)] + public string LocalServerObjectsRoot + { + get => Model.LocalServerObjectsRoot; + set => Model.LocalServerObjectsRoot = value; + } + + [Category("Local Server"), DisplayName("Palette map file"), Description("Path to the palette PNG used by the embedded server for rendering object previews.")] + public string LocalServerPaletteMapFile + { + get => Model.LocalServerPaletteMapFile; + set => Model.LocalServerPaletteMapFile = value; + } + + #endregion } diff --git a/Gui/ViewModels/FolderTreeViewModel.cs b/Gui/ViewModels/FolderTreeViewModel.cs index ae73ff00..1c0caf04 100644 --- a/Gui/ViewModels/FolderTreeViewModel.cs +++ b/Gui/ViewModels/FolderTreeViewModel.cs @@ -3,6 +3,7 @@ using Avalonia.Threading; using Common; using Dat.Data; +using Definitions; using Definitions.DTO; using Definitions.ObjectModels; using Definitions.ObjectModels.Objects.Vehicle; @@ -12,7 +13,6 @@ using DynamicData.Binding; using Gui.Models; using Gui.ViewModels.Filters; -using Index; using Microsoft.Extensions.Logging; using MsBox.Avalonia; using MsBox.Avalonia.Dto; diff --git a/Gui/ViewModels/Loco/BaseFileViewModel.cs b/Gui/ViewModels/Loco/BaseFileViewModel.cs index 00f6abd0..83b41106 100644 --- a/Gui/ViewModels/Loco/BaseFileViewModel.cs +++ b/Gui/ViewModels/Loco/BaseFileViewModel.cs @@ -1,3 +1,4 @@ +using Definitions; using Avalonia.Controls; using Dat.Data; using Definitions.ObjectModels.Types; diff --git a/Gui/ViewModels/Loco/G1ViewModel.cs b/Gui/ViewModels/Loco/G1ViewModel.cs index f3eb9735..1e7e7136 100644 --- a/Gui/ViewModels/Loco/G1ViewModel.cs +++ b/Gui/ViewModels/Loco/G1ViewModel.cs @@ -1,3 +1,4 @@ +using Definitions; using Dat.FileParsing; using Dat.Types; using Gui.Models; diff --git a/Gui/ViewModels/Loco/IFileViewModel.cs b/Gui/ViewModels/Loco/IFileViewModel.cs index aa3730e1..b5d3282a 100644 --- a/Gui/ViewModels/Loco/IFileViewModel.cs +++ b/Gui/ViewModels/Loco/IFileViewModel.cs @@ -1,3 +1,4 @@ +using Definitions; using Gui.Models; using ReactiveUI; using ReactiveUI.Fody.Helpers; diff --git a/Gui/ViewModels/Loco/MusicViewModel.cs b/Gui/ViewModels/Loco/MusicViewModel.cs index 40233ade..cb11dd0f 100644 --- a/Gui/ViewModels/Loco/MusicViewModel.cs +++ b/Gui/ViewModels/Loco/MusicViewModel.cs @@ -1,3 +1,4 @@ +using Definitions; using Dat.Data; using Dat.FileParsing; using Gui.Models; diff --git a/Gui/ViewModels/Loco/ObjectEditorViewModel.cs b/Gui/ViewModels/Loco/ObjectEditorViewModel.cs index b84df476..72c451e2 100644 --- a/Gui/ViewModels/Loco/ObjectEditorViewModel.cs +++ b/Gui/ViewModels/Loco/ObjectEditorViewModel.cs @@ -1,3 +1,4 @@ +using Definitions; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; diff --git a/Gui/ViewModels/Loco/SCV5ViewModel.cs b/Gui/ViewModels/Loco/SCV5ViewModel.cs index c48697dd..f1b07ed8 100644 --- a/Gui/ViewModels/Loco/SCV5ViewModel.cs +++ b/Gui/ViewModels/Loco/SCV5ViewModel.cs @@ -6,7 +6,7 @@ using Definitions.DTO; using Definitions.ObjectModels.Types; using Gui.Models; -using Index; +using Definitions; using Microsoft.Extensions.Logging; using PropertyModels.Extensions; using ReactiveUI; @@ -132,7 +132,10 @@ async Task DownloadMissingObjects(GameObjDataFolder targetFolder) return; } - var gameFolderIndex = await ObjectIndex.LoadOrCreateIndexAsync(folder, Logger).ConfigureAwait(true); + var gameFolderScan = await Dat.Services.DatFolderScanner.ScanDirectoryAsync(folder, Logger).ConfigureAwait(true); + var gameFolderIndex = new ObjectIndex(gameFolderScan.Succeeded.Select(r => new ObjectIndexEntry( + r.DatName, r.RelativePath, null, r.DatChecksum, r.xxHash3, + r.ObjectType, r.ObjectSource, r.CreatedDate, r.ModifiedDate, r.VehicleType))); if (EditorContext.ObjectIndexOnline == null) { diff --git a/Gui/ViewModels/Loco/SoundEffectsViewModel.cs b/Gui/ViewModels/Loco/SoundEffectsViewModel.cs index 13c313fa..e2009328 100644 --- a/Gui/ViewModels/Loco/SoundEffectsViewModel.cs +++ b/Gui/ViewModels/Loco/SoundEffectsViewModel.cs @@ -1,3 +1,4 @@ +using Definitions; using Dat.Data; using Dat.FileParsing; using Definitions.ObjectModels.Objects.Sound; diff --git a/Gui/ViewModels/MainWindowViewModel.cs b/Gui/ViewModels/MainWindowViewModel.cs index 3abfda25..f8b40644 100644 --- a/Gui/ViewModels/MainWindowViewModel.cs +++ b/Gui/ViewModels/MainWindowViewModel.cs @@ -1,4 +1,6 @@ +using Definitions; using Avalonia; +using Avalonia.Media; using Avalonia.Platform; using Avalonia.Platform.Storage; using Common; @@ -6,6 +8,7 @@ using Definitions.ObjectModels; using DynamicData; using Gui.Models; +using Gui.Services; using Gui.ViewModels.Loco.Tutorial; using Microsoft.Extensions.Logging; using NuGet.Versioning; @@ -68,6 +71,38 @@ public string WindowTitle [Reactive] public bool IsUpdateAvailable { get; set; } + #region Local server status indicator + + [Reactive] + public string LocalServerStatusText { get; private set; } = string.Empty; + + [Reactive] + public string LocalServerStatusMessage { get; private set; } = string.Empty; + + [Reactive] + public string LocalServerIcon { get; private set; } = "ServerOff"; + + [Reactive] + public IBrush LocalServerBrush { get; private set; } = Brushes.Gray; + + #endregion + + #region Remote master server status indicator + + [Reactive] + public string RemoteServerStatusText { get; private set; } = string.Empty; + + [Reactive] + public string RemoteServerStatusMessage { get; private set; } = string.Empty; + + [Reactive] + public string RemoteServerIcon { get; private set; } = "CloudQuestion"; + + [Reactive] + public IBrush RemoteServerBrush { get; private set; } = Brushes.Gray; + + #endregion + const string DefaultPaletteImageString = "avares://ObjectEditor/Assets/palette.png"; Image DefaultPaletteImage { get; init; } @@ -142,6 +177,10 @@ public MainWindowViewModel() var vm = new EditorSettingsWindowViewModel(EditorContext.Settings); var result = await OpenEditorSettingsWindow.Handle(vm); EditorContext.Settings.Save(ObjectEditorContext.SettingsFile, EditorContext.Logger); + + // Hot-reapply: stop/start the embedded host so any changes to its dependent + // paths (objects root, palette, port) take effect immediately, without an editor restart. + await EditorContext.RestartLocalServerAsync(); }); OpenLogWindow = new(); @@ -186,6 +225,103 @@ public MainWindowViewModel() _ = CheckForLatestVersionAsync(); #endif + WireLocalServerStatus(); + WireRemoteServerStatus(); + } + + void WireLocalServerStatus() + { + // React to host state/address changes and recompute the indicator props on the UI + // thread. ObserveOn(RxSchedulers.MainThreadScheduler) keeps Avalonia bindings happy. + _ = EditorContext.LocalServerHost + .WhenAnyValue(o => o.State, o => o.StatusMessage, o => o.BaseAddress) + .ObserveOn(RxSchedulers.MainThreadScheduler) + .Subscribe(_ => UpdateLocalServerIndicator()); + + UpdateLocalServerIndicator(); + } + + void WireRemoteServerStatus() + { + _ = EditorContext.RemoteServerMonitor + .WhenAnyValue(o => o.State, o => o.StatusMessage, o => o.Address) + .ObserveOn(RxSchedulers.MainThreadScheduler) + .Subscribe(_ => UpdateRemoteServerIndicator()); + + UpdateRemoteServerIndicator(); + } + + void UpdateLocalServerIndicator() + { + var host = EditorContext.LocalServerHost; + + switch (host.State) + { + case EmbeddedHostState.Starting: + LocalServerIcon = "ServerNetwork"; + LocalServerBrush = Brushes.DarkOrange; + LocalServerStatusText = "Local server starting"; + LocalServerStatusMessage = host.StatusMessage ?? "Starting..."; + break; + case EmbeddedHostState.Running: + LocalServerIcon = "ServerNetwork"; + LocalServerBrush = Brushes.MediumSeaGreen; + LocalServerStatusText = $"Local server: {host.BaseAddress?.Authority}"; + LocalServerStatusMessage = host.StatusMessage ?? $"Running at {host.BaseAddress}"; + break; + case EmbeddedHostState.Failed: + LocalServerIcon = "ServerOff"; + LocalServerBrush = Brushes.IndianRed; + LocalServerStatusText = "Local server failed"; + LocalServerStatusMessage = host.StatusMessage ?? "Failed to start."; + break; + case EmbeddedHostState.Stopped: + LocalServerIcon = "ServerOff"; + LocalServerBrush = Brushes.Gray; + LocalServerStatusText = "Local server stopped"; + LocalServerStatusMessage = host.StatusMessage ?? "Stopped."; + break; + default: + LocalServerIcon = "ServerOff"; + LocalServerBrush = Brushes.Gray; + LocalServerStatusText = "Local server: not started"; + LocalServerStatusMessage = host.StatusMessage ?? "Not started."; + break; + } + } + + void UpdateRemoteServerIndicator() + { + var monitor = EditorContext.RemoteServerMonitor; + var authority = monitor.Address?.Authority ?? "not configured"; + + switch (monitor.State) + { + case RemoteServerState.Checking: + RemoteServerIcon = "CloudSync"; + RemoteServerBrush = Brushes.DarkOrange; + RemoteServerStatusText = $"Master server: checking {authority}"; + RemoteServerStatusMessage = monitor.StatusMessage ?? "Checking..."; + break; + case RemoteServerState.Reachable: + RemoteServerIcon = "CloudCheck"; + RemoteServerBrush = Brushes.MediumSeaGreen; + RemoteServerStatusText = $"Master server: {authority}"; + RemoteServerStatusMessage = monitor.StatusMessage ?? $"Reachable at {monitor.Address}"; + break; + case RemoteServerState.Unreachable: + RemoteServerIcon = "CloudOff"; + RemoteServerBrush = Brushes.IndianRed; + RemoteServerStatusText = $"Master server: unreachable"; + RemoteServerStatusMessage = monitor.StatusMessage ?? $"Unreachable: {authority}"; + break; + default: + RemoteServerIcon = "CloudQuestion"; + RemoteServerBrush = Brushes.Gray; + RemoteServerStatusText = $"Master server: {authority}"; + RemoteServerStatusMessage = monitor.StatusMessage ?? "Status unknown."; + break; + } } #if !DEBUG diff --git a/Gui/ViewModels/ObjectSelectionWindowViewModel.cs b/Gui/ViewModels/ObjectSelectionWindowViewModel.cs index d391c529..a9e5e3a1 100644 --- a/Gui/ViewModels/ObjectSelectionWindowViewModel.cs +++ b/Gui/ViewModels/ObjectSelectionWindowViewModel.cs @@ -1,5 +1,5 @@ using DynamicData; -using Index; +using Definitions; using ReactiveUI; using ReactiveUI.Fody.Helpers; using System; diff --git a/Gui/ViewModels/RequiredObjectsListViewModel.cs b/Gui/ViewModels/RequiredObjectsListViewModel.cs index 429bbaca..2aaee439 100644 --- a/Gui/ViewModels/RequiredObjectsListViewModel.cs +++ b/Gui/ViewModels/RequiredObjectsListViewModel.cs @@ -5,7 +5,6 @@ using DynamicData; using Gui.Models; using Gui.Views; -using Index; using ReactiveUI; using ReactiveUI.Fody.Helpers; using System; @@ -130,11 +129,10 @@ async Task PopulateFromFolderAsync() var dirPath = dir.Path.LocalPath; var logger = editorContext?.Logger ?? new Logger(); - var objectIndex = await ObjectIndex.CreateIndexAsync(dirPath, logger); + var scan = await Dat.Services.DatFolderScanner.ScanDirectoryAsync(dirPath, logger); - var headers = objectIndex.Objects - .Where(x => x.DatChecksum.HasValue) - .Select(entry => new ObjectModelHeader(entry.DisplayName, entry.ObjectType, entry.ObjectSource, entry.DatChecksum!.Value)); + var headers = scan.Succeeded + .Select(entry => new ObjectModelHeader(entry.DatName, entry.ObjectType, entry.ObjectSource, entry.DatChecksum)); Replace(headers); } diff --git a/Gui/Views/MainWindow.axaml b/Gui/Views/MainWindow.axaml index d0b8c163..3aa07b50 100644 --- a/Gui/Views/MainWindow.axaml +++ b/Gui/Views/MainWindow.axaml @@ -199,6 +199,18 @@ + + + + + + + + + + + + diff --git a/Index/Index.csproj b/Index/Index.csproj deleted file mode 100644 index f0cf31ca..00000000 --- a/Index/Index.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net10.0 - enable - enable - - - - - - - - - - - - - diff --git a/Index/ObjectIndex.cs b/Index/ObjectIndex.cs deleted file mode 100644 index de6282d9..00000000 --- a/Index/ObjectIndex.cs +++ /dev/null @@ -1,205 +0,0 @@ -using Common.Json; -using Dat.Converters; -using Dat.Data; -using Dat.FileParsing; -using Dat.Types; -using Definitions.ObjectModels.Objects.Vehicle; -using Definitions.ObjectModels.Types; -using Microsoft.Extensions.Logging; -using System.Collections.Concurrent; -using System.Collections.ObjectModel; -using System.IO.Hashing; -using System.Text.Json.Serialization; - -namespace Index; - -public class ObjectIndex -{ - public ObservableCollection Objects { get; init; } = []; - - [JsonIgnore] - public const string DefaultIndexFileName = "objectIndex.json"; - - [JsonIgnore] - public const string DefaultIndexDbFileName = "objectIndex.db"; - - public ObjectIndex() - { } - - public ObjectIndex(ObservableCollection objects) - => Objects = objects; - - public ObjectIndex(IEnumerable objects) - => Objects = [.. objects]; - - public bool TryFind((string datName, uint datChecksum) key, out ObjectIndexEntry? entry) - { - entry = Objects.FirstOrDefault(x => x.DisplayName == key.datName && x.DatChecksum == key.datChecksum); - return entry != null; - } - - public bool TryFind(ulong xxHash3, out ObjectIndexEntry? entry) - { - entry = Objects.FirstOrDefault(x => x.xxHash3 == xxHash3); - return entry != null; - } - - //public bool TryFind(string internalName, out ObjectIndexEntry? entry) - //{ - // entry = Objects.FirstOrDefault(x => x.InternalName == internalName); - // return entry != null; - //} - - public async Task SaveIndexAsync(string indexFile) - => await JsonFile.SerializeToFileAsync(this, indexFile, JsonFile.DefaultSerializerOptions).ConfigureAwait(false); - - public static async Task LoadIndexAsync(string indexFile) - => await JsonFile.DeserializeFromFileAsync(indexFile, JsonFile.DefaultSerializerOptions).ConfigureAwait(false); - - // Synchronous wrapper retained for the various console utility apps (DataQuery, - // DataSanitiser, DatabaseImporter, etc.) which have no SynchronizationContext and - // cannot meaningfully be made async-from-Main everywhere. Avoid calling this from - // UI thread code — use LoadOrCreateIndexAsync instead. - public static ObjectIndex LoadOrCreateIndex(string directory, ILogger logger, IProgress? progress = null) - => LoadOrCreateIndexAsync(directory, logger, progress).GetAwaiter().GetResult(); - - public static async Task LoadOrCreateIndexAsync(string directory, ILogger logger, IProgress? progress = null) - { - var indexPath = Path.Combine(directory, DefaultIndexFileName); - ObjectIndex? index = null; - if (File.Exists(indexPath)) - { - logger.LogInformation("Index file found - loading it"); - index = await LoadIndexAsync(indexPath).ConfigureAwait(false); - } - - if (index == null) - { - logger.LogInformation("Index file not found - creating it"); - index = await CreateIndexAsync(directory, logger, progress).ConfigureAwait(false); - await index.SaveIndexAsync(indexPath).ConfigureAwait(false); - } - - return index; - } - - public static Task CreateIndexAsync(string directory, ILogger logger, IProgress? progress = null) - => Task.Run(() => CreateIndex(directory, logger, progress)); - - public ObjectIndex UpdateIndex(string directory, ILogger logger, IEnumerable filesToAdd, IProgress? progress = null) - { - var (succeeded, failed) = ReadFilesFromDisk(directory, logger, progress, [.. filesToAdd]); - - foreach (var s in succeeded) - { - Objects.Add(s); - } - - foreach (var f in failed) - { - logger.LogError("Failed to load {F}", f); - } - - return this; - } - - public static ObjectIndex CreateIndex(string directory, ILogger logger, IProgress? progress = null) - => new ObjectIndex().UpdateIndex(directory, logger, [.. SawyerStreamUtils.GetDatFilesInDirectory(directory)], progress); - - static (ConcurrentQueue succeeded, ConcurrentQueue failed) ReadFilesFromDisk(string directory, ILogger logger, IProgress? progress, string[] files) - { - ConcurrentQueue pendingIndices = []; - ConcurrentQueue failedFiles = []; - _ = Parallel.ForEach(files, file => ParseFile(directory, file, pendingIndices, failedFiles, files.Length, progress, logger)); - return (pendingIndices, failedFiles); - } - - public void Delete(Func predicate) - { - foreach (var d in Objects.Where(predicate).ToList()) - { - _ = Objects.Remove(d); - } - } - - static void ParseFile(string directory, string filename, ConcurrentQueue pendingIndices, ConcurrentQueue failedFiles, int totalFiles, IProgress? progress, ILogger logger) - { - var fullFilename = Path.Combine(directory, filename); - - if (File.Exists(fullFilename)) - { - var bytes = File.ReadAllBytes(fullFilename); - ObjectIndexEntry? entry = null; - - try - { - entry = GetDatFileInfoFromBytes(fullFilename, filename, bytes, logger); - } - catch (Exception ex) - { - logger.LogError(ex, "Failed to parse file \"{Filename}\"", filename); - } - - if (entry == null) - { - failedFiles.Enqueue(filename); - } - else - { - pendingIndices.Enqueue(entry); - } - } - else - { - failedFiles.Enqueue(filename); - } - - progress?.Report((pendingIndices.Count + failedFiles.Count) / (float)totalFiles); - } - - public static ObjectIndexEntry? GetDatFileInfoFromBytes(string absoluteFilename, string relativeFilename, byte[] data, ILogger logger) - { - var xxHash3 = XxHash3.HashToUInt64(data); - - if (!SawyerStreamReader.TryGetHeadersFromBytes(data, out var hdrs, logger)) - { - logger.LogError("{RelativeFilename} must have valid S5 and Object headers to call this method", relativeFilename); - return null; - } - - var remainingData = data[(S5Header.StructLength + ObjectHeader.StructLength)..]; - var source = OriginalObjectFiles.GetFileSource(hdrs.S5.Name, hdrs.S5.Checksum, hdrs.S5.ObjectSource); - - var createdTime = DateOnly.FromDateTime(File.GetCreationTimeUtc(absoluteFilename)); - var modifiedTime = DateOnly.FromDateTime(File.GetLastWriteTimeUtc(absoluteFilename)); - - var objType = hdrs.S5.ObjectType.Convert(); - if (objType == ObjectType.Vehicle) - { - var decoded = SawyerStreamReader.Decode(hdrs.Obj.Encoding, remainingData, 4); // only need 4 bytes since vehicle type is in the 4th byte of a vehicle object - var vType = (VehicleType)decoded[3]; - return new ObjectIndexEntry(hdrs.S5.Name, relativeFilename, null, hdrs.S5.Checksum, xxHash3, objType, source, createdTime, modifiedTime, vType); - } - else - { - return new ObjectIndexEntry(hdrs.S5.Name, relativeFilename, null, hdrs.S5.Checksum, xxHash3, objType, source, createdTime, modifiedTime); - } - } -} - -public record ObjectIndexEntry( - string DisplayName, - string? FileName, // only available in local mode - UniqueObjectId? Id, // only available in online-mode - uint32_t? DatChecksum, - ulong? xxHash3, - ObjectType ObjectType, - ObjectSource ObjectSource, - DateOnly? CreatedDate, - DateOnly? ModifiedDate, - VehicleType? VehicleType = null) -{ - [JsonIgnore] - public string SimpleText - => $"{DisplayName} | {FileName}"; -} diff --git a/ObjectEditor.sln b/ObjectEditor.sln index fafe05ec..acde6d62 100644 --- a/ObjectEditor.sln +++ b/ObjectEditor.sln @@ -36,8 +36,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Definitions", "Definitions\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaletteGenerator", "PaletteGenerator\PaletteGenerator.csproj", "{010B8AB4-9867-4BE0-A663-6261DA4056F9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Index", "Index\Index.csproj", "{26FB082F-DEC4-4501-907F-16E99C4D6442}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuiUpdater", "GuiUpdater\GuiUpdater.csproj", "{1EB4464D-4262-4679-AA0C-43DD6A0368E1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseTools", "DatabaseTools\DatabaseTools.csproj", "{D8B4E93C-CDB5-4E27-902E-04DAE06075AE}" @@ -136,18 +134,6 @@ Global {010B8AB4-9867-4BE0-A663-6261DA4056F9}.Release|x64.Build.0 = Release|Any CPU {010B8AB4-9867-4BE0-A663-6261DA4056F9}.Release|x86.ActiveCfg = Release|Any CPU {010B8AB4-9867-4BE0-A663-6261DA4056F9}.Release|x86.Build.0 = Release|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Debug|x64.ActiveCfg = Debug|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Debug|x64.Build.0 = Debug|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Debug|x86.ActiveCfg = Debug|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Debug|x86.Build.0 = Debug|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Release|Any CPU.Build.0 = Release|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Release|x64.ActiveCfg = Release|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Release|x64.Build.0 = Release|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Release|x86.ActiveCfg = Release|Any CPU - {26FB082F-DEC4-4501-907F-16E99C4D6442}.Release|x86.Build.0 = Release|Any CPU {1EB4464D-4262-4679-AA0C-43DD6A0368E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1EB4464D-4262-4679-AA0C-43DD6A0368E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1EB4464D-4262-4679-AA0C-43DD6A0368E1}.Debug|x64.ActiveCfg = Debug|Any CPU diff --git a/ObjectService/Hosting/ObjectServiceHost.cs b/ObjectService/Hosting/ObjectServiceHost.cs new file mode 100644 index 00000000..3a15c189 --- /dev/null +++ b/ObjectService/Hosting/ObjectServiceHost.cs @@ -0,0 +1,289 @@ +using Definitions.Database; +using Definitions.ObjectModels; +using Microsoft.AspNetCore.Authentication.BearerToken; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.HttpLogging; +using Microsoft.AspNetCore.HttpOverrides; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.RateLimiting; +using Microsoft.EntityFrameworkCore; +using Microsoft.IdentityModel.Tokens; +using Microsoft.OpenApi; +using ObjectService.Frontend; +using ObjectService.RouteHandlers; +using ObjectService.Services; +using Scalar.AspNetCore; +using System.Text; +using System.Threading.RateLimiting; +namespace ObjectService.Hosting; + +// Reusable composition of the OpenLoco Object Service web application. +// Program.cs (standalone server) and the GUI's EmbeddedObjectServiceHost both go through +// this class so behavior stays in sync across the two hosting modes. +public static class ObjectServiceHost +{ + public const string TokenPolicy = "token"; + + // Layer the embedded options onto the configuration before any services are registered. + // This keeps the existing IConfiguration-based wiring untouched. + public static void ApplyOptionsToConfiguration(WebApplicationBuilder builder, ObjectServiceHostOptions options) + { + var overrides = new Dictionary + { + ["ConnectionStrings:SQLiteConnection"] = $"Data Source={options.DatabaseFile}", + ["ObjectService:RootFolder"] = options.RootFolder, + ["ObjectService:PaletteMapFile"] = options.PaletteMapFile, + ["ObjectService:ShowScalar"] = options.ShowScalar ? "true" : "false", + ["JwtSettings:Key"] = options.JwtKey, + ["JwtSettings:Issuer"] = options.JwtIssuer, + ["JwtSettings:Audience"] = options.JwtAudience, + ["JwtSettings:DurationInMinutes"] = options.JwtDurationInMinutes.ToString(), + }; + + // Kestrel endpoints: replace any inherited config so the embedded host doesn't + // accidentally bind to the standalone server's ports. + overrides["Kestrel:Endpoints:Http:Url"] = options.HttpUrl; + if (!string.IsNullOrWhiteSpace(options.HttpsUrl)) + { + overrides["Kestrel:Endpoints:HttpsDefaultCert:Url"] = options.HttpsUrl; + } + + _ = builder.Configuration.AddInMemoryCollection(overrides); + } + + // Creates the on-disk artifacts the server expects: the objects-root folder tree, the + // parent directory of the SQLite database file, and ensures the appropriate Loco + // schema is migrated. For server hosts (options.IsServer = true) the IdentityContext + // schema is migrated too; client hosts skip Identity so their DBs stay free of the + // server-only AspNet* tables. Idempotent and safe to call on every startup. + public static async Task BootstrapAsync(ObjectServiceHostOptions options, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(options); + + ServerFolderManager.EnsureFolderStructure(options.RootFolder); + + var dbDirectory = Path.GetDirectoryName(Path.GetFullPath(options.DatabaseFile)); + if (!string.IsNullOrEmpty(dbDirectory)) + { + _ = Directory.CreateDirectory(dbDirectory); + } + + var connectionString = $"Data Source={options.DatabaseFile}"; + + if (options.IsServer) + { + // Server uses LocoDbContext (which is the concrete type the existing + // /Definitions/Migrations/Loco snapshot is tied to). ServerLocoDbContext + // exists as a future hook for server-only schema additions. + var locoOptions = new DbContextOptionsBuilder() + .UseSqlite(connectionString) + .Options; + await using var locoDb = new LocoDbContext(locoOptions); + await locoDb.Database.MigrateAsync(cancellationToken); + + var identityOptions = new DbContextOptionsBuilder() + .UseSqlite(connectionString, sql => sql.MigrationsHistoryTable(IdentityContext.MigrationsHistoryTableName)) + .Options; + await using var identityDb = new IdentityContext(identityOptions); + await identityDb.Database.MigrateAsync(cancellationToken); + } + else + { + // Client uses ClientLocoDbContext with EnsureCreated. Client DBs are local + // caches; there is no migration history table for this context. If the + // schema evolves the client DB is regenerated rather than migrated. + var clientLocoOptions = new DbContextOptionsBuilder() + .UseSqlite(connectionString) + .Options; + await using var clientLocoDb = new ClientLocoDbContext(clientLocoOptions); + _ = await clientLocoDb.Database.EnsureCreatedAsync(cancellationToken); + } + } + + public static void ConfigureBuilder(WebApplicationBuilder builder) + { + var connectionString = builder.Configuration.GetConnectionString("SQLiteConnection"); + + _ = builder.Services.AddOpenApi(options => + { + _ = options.AddDocumentTransformer((document, context, cancellationToken) => + { + document.Info.Title = "OpenLoco Object Service"; + document.Info.Version = "2.0"; + document.Info.Contact = new OpenApiContact + { + Name = "Left of Zen", + Email = "leftofzen@openloco.io" + }; + + document.Servers?.Clear(); + document.Servers?.Add(new OpenApiServer() { Url = "https://openloco.leftofzen.dev" }); + + return Task.CompletedTask; + }); + }); + + _ = builder.Services.AddEndpointsApiExplorer(); + _ = builder.Services.AddHealthChecks() + .AddCheck("object-service"); + _ = builder.Services.AddProblemDetails(); + _ = builder.Services.AddRazorPages(); + _ = builder.Services.AddHttpClient(); + _ = builder.Services.AddHttpContextAccessor(); + _ = builder.Services.AddDbContext(options => + { + _ = options.UseSqlite(connectionString); + if (builder.Environment.IsDevelopment()) + { + _ = options.EnableDetailedErrors(); + _ = options.EnableSensitiveDataLogging(); + } + }); + + _ = builder.Services.AddDbContext(options => + { + _ = options.UseSqlite(connectionString, sql => sql.MigrationsHistoryTable(IdentityContext.MigrationsHistoryTableName)); + if (builder.Environment.IsDevelopment()) + { + _ = options.EnableDetailedErrors(); + _ = options.EnableSensitiveDataLogging(); + } + }); + + _ = builder.Services.AddScoped(); + _ = builder.Services.AddDatabaseDeveloperPageExceptionFilter(); + + var objRoot = builder.Configuration["ObjectService:RootFolder"]; + var paletteMapFile = builder.Configuration["ObjectService:PaletteMapFile"]; + ArgumentNullException.ThrowIfNull(objRoot); + ArgumentNullException.ThrowIfNull(paletteMapFile); + ArgumentNullException.ThrowIfNull(connectionString); + + var serverFolderManager = new ServerFolderManager(objRoot, connectionString.Replace("Data Source=", string.Empty)); + var paletteMap = new PaletteMap(paletteMapFile); + + _ = builder.Services.AddSingleton(serverFolderManager); + _ = builder.Services.AddSingleton(paletteMap); + + _ = builder.Services.AddHttpLogging(logging => + { + _ = logging.RequestHeaders.Add("Cdn-Loop"); + _ = logging.RequestHeaders.Add("Cf-Connecting-Ip"); + _ = logging.RequestHeaders.Add("Cf-Ipcountry"); + _ = logging.RequestHeaders.Add("Cf-Ray"); + _ = logging.RequestHeaders.Add("Cf-Visitor"); + _ = logging.RequestHeaders.Add("Cf-Warp-Tag-Id"); + _ = logging.RequestHeaders.Add("X-Forwarded-For"); + _ = logging.RequestHeaders.Add("X-Forwarded-Proto"); + + logging.LoggingFields = HttpLoggingFields.All; + logging.CombineLogs = true; + }); + + var rateLimiterSection = builder.Configuration.GetSection("ObjectService:RateLimiter"); + ArgumentNullException.ThrowIfNull(rateLimiterSection); + var rateLimiter = new RateLimitOptions(); + rateLimiterSection.Bind(rateLimiter); + + _ = builder.Services.Configure(options => + { + options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; + }); + + _ = builder.Services.AddRateLimiter(rlOptions => rlOptions + .AddTokenBucketLimiter(policyName: TokenPolicy, options => + { + options.TokenLimit = rateLimiter.TokenLimit; + options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst; + options.QueueLimit = rateLimiter.QueueLimit; + options.ReplenishmentPeriod = TimeSpan.FromSeconds(rateLimiter.ReplenishmentPeriod); + options.TokensPerPeriod = rateLimiter.TokensReplenishedPerPeriod; + options.AutoReplenishment = rateLimiter.AutoReplenishment; + rlOptions.OnRejected = (context, cancellationToken) => + { + if (context.Lease.TryGetMetadata(MetadataName.RetryAfter, out var retryAfter)) + { + context.HttpContext.Response.Headers.RetryAfter = retryAfter.TotalSeconds.ToString(); + } + + context.HttpContext.Response.StatusCode = StatusCodes.Status429TooManyRequests; + _ = context.HttpContext.Response.WriteAsync("Too many requests. Please try again later.", cancellationToken); + + return new ValueTask(); + }; + })); + + _ = builder.Services + .AddIdentityApiEndpoints() + .AddEntityFrameworkStores(); + + _ = builder.Services.Configure(IdentityConstants.BearerScheme, options => + { + var durationInMinutes = builder.Configuration.GetValue("JwtSettings:DurationInMinutes") ?? 60; + options.BearerTokenExpiration = TimeSpan.FromMinutes(durationInMinutes); + }); + + _ = builder.Services.AddAuthentication() + .AddJwtBearer(options => + { + options.TokenValidationParameters = new TokenValidationParameters + { + ValidateIssuer = true, + ValidateAudience = true, + ValidateLifetime = true, + ValidateIssuerSigningKey = true, + ValidIssuer = builder.Configuration["JwtSettings:Issuer"], + ValidAudience = builder.Configuration["JwtSettings:Audience"], + IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["JwtSettings:Key"] ?? throw new InvalidOperationException("JWT Key not configured"))), + }; + }); + + _ = builder.Services.AddAuthorization(options => + { + options.DefaultPolicy = new Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder() + .AddAuthenticationSchemes(IdentityConstants.BearerScheme, JwtBearerDefaults.AuthenticationScheme) + .RequireAuthenticatedUser() + .Build(); + }); + } + + public static void Configure(WebApplication app) + { + app.UseForwardedHeaders(); + app.UseHttpLogging(); + app.UseRateLimiter(); + app.UseStaticFiles(); + app.UseAuthentication(); + app.UseAuthorization(); + + app.MapIdentityApi(); + + _ = app + .MapHealthChecks("/health") + .RequireRateLimiting(TokenPolicy); + + _ = app.MapRazorPages(); + + _ = app.MapV2Routes() + .RequireRateLimiting(TokenPolicy); + + _ = app.MapV1Routes() + .RequireRateLimiting(TokenPolicy); + + var showScalar = app.Configuration.GetValue("ObjectService:ShowScalar"); + + _ = app.MapOpenApi(); + + if (showScalar == true) + { + _ = app.MapScalarApiReference("/api", options => + { + _ = options + .WithTitle("OpenLoco Object Service") + .WithTheme(ScalarTheme.Solarized) + .WithDefaultHttpClient(ScalarTarget.CSharp, ScalarClient.HttpClient) + .AddPreferredSecuritySchemes("Bearer"); + }); + } + } +} diff --git a/ObjectService/Hosting/ObjectServiceHostOptions.cs b/ObjectService/Hosting/ObjectServiceHostOptions.cs new file mode 100644 index 00000000..d765b1a6 --- /dev/null +++ b/ObjectService/Hosting/ObjectServiceHostOptions.cs @@ -0,0 +1,42 @@ +namespace ObjectService.Hosting; + +// Options consumed by ObjectServiceHost when an embedding application (eg. the GUI) +// wants to spin up the web server in-process rather than relying on appsettings.json. +// Each property maps onto a configuration key that the existing Program/Host code already reads, +// so any value set here is layered onto the builder configuration via an in-memory provider. +public sealed record ObjectServiceHostOptions +{ + // Filesystem root containing the .dat objects to serve. + public required string RootFolder { get; init; } + + // Path to the SQLite database file backing the Loco object schema (and, for the + // standalone server, IdentityContext as well). + public required string DatabaseFile { get; init; } + + // Path to the palette PNG used to colourise rendered object previews. + public required string PaletteMapFile { get; init; } + + // HTTP listen URL. Defaults to a loopback ephemeral-style port for embedded scenarios. + public string HttpUrl { get; init; } = "http://127.0.0.1:0"; + + // Optional HTTPS listen URL. Leave null to disable the HTTPS endpoint entirely + // (embedded GUI does not need TLS to itself). + public string? HttpsUrl { get; init; } + + // Whether to expose the Scalar API reference at /api. + public bool ShowScalar { get; init; } + + // JWT signing key. Required by the existing auth pipeline; embedded callers + // should generate a per-session random key. + public required string JwtKey { get; init; } + public string JwtIssuer { get; init; } = "ObjectEditor.Local"; + public string JwtAudience { get; init; } = "ObjectEditor.Local"; + public int JwtDurationInMinutes { get; init; } = 60; + + // True (default) for the standalone server: applies migrations for both the Loco + // schema and the ASP.NET Identity schema, materialises the full set of AspNet* + // tables, and uses ServerLocoDbContext for the object schema. + // False for the embedded GUI host: uses ClientLocoDbContext and skips Identity + // migration entirely, so client databases never get the server-only Identity tables. + public bool IsServer { get; init; } = true; +} diff --git a/ObjectService/ObjectService.csproj b/ObjectService/ObjectService.csproj index 1a22596c..3357f095 100644 --- a/ObjectService/ObjectService.csproj +++ b/ObjectService/ObjectService.csproj @@ -24,13 +24,17 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - diff --git a/ObjectService/Program.cs b/ObjectService/Program.cs index 4c052566..be124e6d 100644 --- a/ObjectService/Program.cs +++ b/ObjectService/Program.cs @@ -1,222 +1,15 @@ -using Definitions.Database; -using Definitions.ObjectModels; -using Microsoft.AspNetCore.Authentication.BearerToken; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.HttpLogging; -using Microsoft.AspNetCore.HttpOverrides; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.RateLimiting; -using Microsoft.EntityFrameworkCore; -using Microsoft.IdentityModel.Tokens; -using Microsoft.OpenApi; -using ObjectService; -using ObjectService.Frontend; -using ObjectService.RouteHandlers; -using ObjectService.Services; -using Scalar.AspNetCore; -using System.Text; -using System.Threading.RateLimiting; +using ObjectService.Hosting; var builder = WebApplication.CreateBuilder(args); builder.Logging.ClearProviders(); builder.Logging.AddConsole(); -var connectionString = builder.Configuration.GetConnectionString("SQLiteConnection"); - -builder.Services.AddOpenApi(options => -{ - _ = options.AddDocumentTransformer((document, context, cancellationToken) => - { - document.Info.Title = "OpenLoco Object Service"; - document.Info.Version = "2.0"; - document.Info.Contact = new OpenApiContact - { - Name = "Left of Zen", - Email = "leftofzen@openloco.io" - }; - - document.Servers?.Clear(); - document.Servers?.Add(new OpenApiServer() { Url = "https://openloco.leftofzen.dev" }); - - return Task.CompletedTask; - }); -}); - -// (options => _ = options.AddDocumentTransformer()); -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddHealthChecks() - .AddCheck("object-service"); -builder.Services.AddProblemDetails(); -builder.Services.AddRazorPages(); -builder.Services.AddHttpClient(); -builder.Services.AddHttpContextAccessor(); -builder.Services.AddDbContext(options => -{ - _ = options.UseSqlite(connectionString); - if (builder.Environment.IsDevelopment()) - { - // EnableSensitiveDataLogging exposes parameter values in logs, which can - // leak PII / secrets. Restrict to the Development environment. - _ = options.EnableDetailedErrors(); - _ = options.EnableSensitiveDataLogging(); - } -}); - -builder.Services.AddScoped(); - -builder.Services.AddDatabaseDeveloperPageExceptionFilter(); - -// this breaks the client side, even if the same converter is added... -//builder.Services.Configure(options => options.SerializerOptions.Converters.Add(new JsonStringEnumConverter())); - -var objRoot = builder.Configuration["ObjectService:RootFolder"]; -var paletteMapFile = builder.Configuration["ObjectService:PaletteMapFile"]; -ArgumentNullException.ThrowIfNull(objRoot); -ArgumentNullException.ThrowIfNull(paletteMapFile); - -var serverFolderManager = new ServerFolderManager(objRoot); -var paletteMap = new PaletteMap(paletteMapFile); - -builder.Services.AddSingleton(serverFolderManager); -builder.Services.AddSingleton(paletteMap); - -//var server = new Server(new ServerSettings(objRoot, paletteMapFile)); -//builder.Services.AddSingleton(server); - -builder.Services.AddHttpLogging(logging => -{ - // these are marked [redacted] in the logs unless specified here - _ = logging.RequestHeaders.Add("Cdn-Loop"); - _ = logging.RequestHeaders.Add("Cf-Connecting-Ip"); - _ = logging.RequestHeaders.Add("Cf-Ipcountry"); - _ = logging.RequestHeaders.Add("Cf-Ray"); - _ = logging.RequestHeaders.Add("Cf-Visitor"); - _ = logging.RequestHeaders.Add("Cf-Warp-Tag-Id"); - _ = logging.RequestHeaders.Add("X-Forwarded-For"); - _ = logging.RequestHeaders.Add("X-Forwarded-Proto"); - - logging.LoggingFields = HttpLoggingFields.All; - //logging.LoggingFields = HttpLoggingFields.ResponsePropertiesAndHeaders | HttpLoggingFields.Duration; // this is `All` excluding `ResponseBody` - logging.CombineLogs = true; -}); - -const string tokenPolicy = "token"; - -var rateLimiterSection = builder.Configuration.GetSection("ObjectService:RateLimiter"); -ArgumentNullException.ThrowIfNull(rateLimiterSection); -var rateLimiter = new RateLimitOptions(); -rateLimiterSection.Bind(rateLimiter); - -builder.Services.Configure(options => -{ - options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; -}); - -builder.Services.AddRateLimiter(rlOptions => rlOptions - .AddTokenBucketLimiter(policyName: tokenPolicy, options => - { - options.TokenLimit = rateLimiter.TokenLimit; - options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst; - options.QueueLimit = rateLimiter.QueueLimit; - options.ReplenishmentPeriod = TimeSpan.FromSeconds(rateLimiter.ReplenishmentPeriod); - options.TokensPerPeriod = rateLimiter.TokensReplenishedPerPeriod; - options.AutoReplenishment = rateLimiter.AutoReplenishment; - rlOptions.OnRejected = (context, cancellationToken) => - { - if (context.Lease.TryGetMetadata(MetadataName.RetryAfter, out var retryAfter)) - { - context.HttpContext.Response.Headers.RetryAfter = retryAfter.TotalSeconds.ToString(); - } - - context.HttpContext.Response.StatusCode = StatusCodes.Status429TooManyRequests; - _ = context.HttpContext.Response.WriteAsync("Too many requests. Please try again later.", cancellationToken); - - return new ValueTask(); - }; - })); - -builder.Services - .AddIdentityApiEndpoints() - .AddEntityFrameworkStores(); - -// Configure bearer token expiration from settings -builder.Services.Configure(IdentityConstants.BearerScheme, options => -{ - var durationInMinutes = builder.Configuration.GetValue("JwtSettings:DurationInMinutes") ?? 60; - options.BearerTokenExpiration = TimeSpan.FromMinutes(durationInMinutes); -}); - -builder.Services.AddAuthentication() -.AddJwtBearer(options => -{ - options.TokenValidationParameters = new TokenValidationParameters - { - ValidateIssuer = true, - ValidateAudience = true, - ValidateLifetime = true, - ValidateIssuerSigningKey = true, - ValidIssuer = builder.Configuration["JwtSettings:Issuer"], - ValidAudience = builder.Configuration["JwtSettings:Audience"], - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["JwtSettings:Key"] ?? throw new InvalidOperationException("JWT Key not configured"))), - }; -}); - -builder.Services.AddAuthorization(options => -{ - // Configure the default policy to accept both Identity Bearer tokens and JWT tokens - options.DefaultPolicy = new Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder() - .AddAuthenticationSchemes(IdentityConstants.BearerScheme, JwtBearerDefaults.AuthenticationScheme) - .RequireAuthenticatedUser() - .Build(); -}); - -// Used for the Identity stuff to send emails to users -// disabling this line effectively disables all email sending, as a default NoOpEmailSender is used in place -// builder.Services.AddTransient(); +ObjectServiceHost.ConfigureBuilder(builder); var app = builder.Build(); -app.UseForwardedHeaders(); -app.UseHttpLogging(); -app.UseRateLimiter(); -app.UseStaticFiles(); -app.UseAuthentication(); -app.UseAuthorization(); - -app.MapIdentityApi(); - -// defining routes here, after MapIdentityApi, will overwrite them, allowing us to customise them -// app.MapPost("/register", () => Results.Ok()); - -_ = app - .MapHealthChecks("/health") - .RequireRateLimiting(tokenPolicy); - -_ = app.MapRazorPages(); - -_ = app.MapV2Routes() - .RequireRateLimiting(tokenPolicy); - -_ = app.MapV1Routes() - .RequireRateLimiting(tokenPolicy); - -var showScalar = builder.Configuration.GetValue("ObjectService:ShowScalar"); -ArgumentNullException.ThrowIfNull(showScalar); - -_ = app.MapOpenApi(); - -if (showScalar == true) -{ - _ = app.MapScalarApiReference("/api", options => - { - _ = options - .WithTitle("OpenLoco Object Service") - .WithTheme(ScalarTheme.Solarized) - .WithDefaultHttpClient(ScalarTarget.CSharp, ScalarClient.HttpClient) - .AddPreferredSecuritySchemes("Bearer"); - }); -} +ObjectServiceHost.Configure(app); app.Run(); diff --git a/ObjectService/RouteHandlers/BaseDataTableRouteHandler.cs b/ObjectService/RouteHandlers/BaseDataTableRouteHandler.cs index 10382a76..2c3c33af 100644 --- a/ObjectService/RouteHandlers/BaseDataTableRouteHandler.cs +++ b/ObjectService/RouteHandlers/BaseDataTableRouteHandler.cs @@ -1,14 +1,14 @@ using Definitions; -using Definitions.Database; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace ObjectService.RouteHandlers; -public abstract class BaseDataTableRouteHandler : ITableRouteHandler +public abstract class BaseDataTableRouteHandler : ITableRouteHandler + where TContext : DbContext where TDto : class, IHasId where TRow : class, IHasId - where THandler : ITableRouteConfig + where THandler : ITableRouteConfig { public static string BaseRoute => THandler.GetBaseRoute(); @@ -22,7 +22,7 @@ public abstract class BaseDataTableRouteHandler : ITableRo public static Delegate DeleteDelegate => DeleteAsync; - public static async Task CreateAsync(TDto request, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task CreateAsync(TDto request, [FromServices] TContext db, CancellationToken cancellationToken) => await BaseDataTableRouteHandlerImpl.CreateAsync( THandler.GetTable(db), THandler.ToDtoFunc, @@ -33,10 +33,10 @@ public static async Task CreateAsync(TDto request, [FromServices] LocoD db, cancellationToken); - public static async Task ReadAsync(UniqueObjectId id, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task ReadAsync(UniqueObjectId id, [FromServices] TContext db, CancellationToken cancellationToken) => await BaseDataTableRouteHandlerImpl.ReadAsync(THandler.GetTable(db), THandler.ToDtoFunc, id, db, cancellationToken); - public static async Task UpdateAsync(UniqueObjectId id, TDto request, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task UpdateAsync(UniqueObjectId id, TDto request, [FromServices] TContext db, CancellationToken cancellationToken) => await BaseDataTableRouteHandlerImpl.UpdateAsync( THandler.GetTable(db), THandler.ToDtoFunc, @@ -49,16 +49,16 @@ public static async Task UpdateAsync(UniqueObjectId id, TDto request, [ THandler.UpdateFunc, cancellationToken); - public static async Task DeleteAsync(UniqueObjectId id, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task DeleteAsync(UniqueObjectId id, [FromServices] TContext db, CancellationToken cancellationToken) => await BaseDataTableRouteHandlerImpl.DeleteAsync(THandler.GetTable(db), THandler.ToDtoFunc, id, db, cancellationToken); - public static async Task ListAsync(HttpContext context, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task ListAsync(HttpContext context, [FromServices] TContext db, CancellationToken cancellationToken) => await BaseDataTableRouteHandlerImpl.ListAsync(context, THandler.GetTable(db), THandler.ToDtoFunc, cancellationToken); } public static class BaseDataTableRouteHandlerImpl { - public static async Task CreateAsync(DbSet table, Func dtoConverter, Func rowConverter, TDto request, Func<(bool Success, IResult? ErrorMessage)> tryValidateFunc, string baseRoute, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task CreateAsync(DbSet table, Func dtoConverter, Func rowConverter, TDto request, Func<(bool Success, IResult? ErrorMessage)> tryValidateFunc, string baseRoute, DbContext db, CancellationToken cancellationToken) where TDto : class, IHasId where TRow : class, IHasId { @@ -74,14 +74,14 @@ public static async Task CreateAsync(DbSet table, Fun return Results.Created($"{baseRoute}/{row.Id}", dtoConverter(row)); } - public static async Task ReadAsync(DbSet table, Func dtoConverter, UniqueObjectId id, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task ReadAsync(DbSet table, Func dtoConverter, UniqueObjectId id, DbContext db, CancellationToken cancellationToken) where TDto : class, IHasId where TRow : class, IHasId => await table.FindAsync([id], cancellationToken) is TRow row ? Results.Ok(dtoConverter(row)) : Results.NotFound(); - public static async Task UpdateAsync(DbSet table, Func dtoConverter, Func rowConverter, TDto request, Func<(bool Success, IResult? ErrorMessage)> tryValidateFunc, string baseRoute, UniqueObjectId id, [FromServices] LocoDbContext db, Action updateFunc, CancellationToken cancellationToken) + public static async Task UpdateAsync(DbSet table, Func dtoConverter, Func rowConverter, TDto request, Func<(bool Success, IResult? ErrorMessage)> tryValidateFunc, string baseRoute, UniqueObjectId id, DbContext db, Action updateFunc, CancellationToken cancellationToken) where TDto : class, IHasId where TRow : class, IHasId { @@ -95,7 +95,7 @@ public static async Task UpdateAsync(DbSet table, Fun return Results.Accepted($"{baseRoute}/{row.Id}", dtoConverter(row)); } - public static async Task DeleteAsync(DbSet table, Func dtoConverter, UniqueObjectId id, [FromServices] LocoDbContext db, CancellationToken cancellationToken) + public static async Task DeleteAsync(DbSet table, Func dtoConverter, UniqueObjectId id, DbContext db, CancellationToken cancellationToken) where TDto : class, IHasId where TRow : class, IHasId { diff --git a/ObjectService/RouteHandlers/ITableRouteConfig.cs b/ObjectService/RouteHandlers/ITableRouteConfig.cs index d0936ebf..f17148b5 100644 --- a/ObjectService/RouteHandlers/ITableRouteConfig.cs +++ b/ObjectService/RouteHandlers/ITableRouteConfig.cs @@ -1,19 +1,19 @@ using Definitions; -using Definitions.Database; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace ObjectService.RouteHandlers; -public interface ITableRouteConfig +public interface ITableRouteConfig + where TContext : DbContext where TDto : class, IHasId where TRow : class, IHasId { static abstract string GetBaseRoute(); - static abstract DbSet GetTable(LocoDbContext db); + static abstract DbSet GetTable(TContext db); static abstract TRow ToRowFunc(TDto request); static abstract TDto ToDtoFunc(TRow request); static abstract void UpdateFunc(TDto request, TRow row); - static abstract bool TryValidateCreate(TDto request, [FromServices] LocoDbContext db, out IResult? result); + static abstract bool TryValidateCreate(TDto request, [FromServices] TContext db, out IResult? result); } diff --git a/ObjectService/RouteHandlers/TableHandlers/AuthorRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/AuthorRouteHandler.cs index 6a72bfa3..8222052e 100644 --- a/ObjectService/RouteHandlers/TableHandlers/AuthorRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/AuthorRouteHandler.cs @@ -8,8 +8,8 @@ namespace ObjectService.RouteHandlers; public class AuthorRouteHandler - : BaseDataTableRouteHandler - , ITableRouteConfig + : BaseDataTableRouteHandler + , ITableRouteConfig { public static string GetBaseRoute() => RoutesV2.Authors; diff --git a/ObjectService/RouteHandlers/TableHandlers/LicenceRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/LicenceRouteHandler.cs index f4de07f0..9abfa6f3 100644 --- a/ObjectService/RouteHandlers/TableHandlers/LicenceRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/LicenceRouteHandler.cs @@ -8,8 +8,8 @@ namespace ObjectService.RouteHandlers.TableHandlers; public class LicenceRouteHandler - : BaseDataTableRouteHandler - , ITableRouteConfig + : BaseDataTableRouteHandler + , ITableRouteConfig { public static string GetBaseRoute() => RoutesV2.Licences; diff --git a/ObjectService/RouteHandlers/TableHandlers/ObjectMissingRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/ObjectMissingRouteHandler.cs index a6da94bc..81b0e2d0 100644 --- a/ObjectService/RouteHandlers/TableHandlers/ObjectMissingRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/ObjectMissingRouteHandler.cs @@ -8,8 +8,8 @@ namespace ObjectService.RouteHandlers.TableHandlers; public class ObjectMissingRouteHandler - : BaseDataTableRouteHandler - , ITableRouteConfig + : BaseDataTableRouteHandler + , ITableRouteConfig { public static string GetBaseRoute() => RoutesV2.Missing; diff --git a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs index 9585d4c1..fbfcadd2 100644 --- a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs @@ -12,7 +12,6 @@ using Definitions.ObjectModels.Types; using Definitions.SourceData; using Definitions.Web; -using Index; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using SixLabors.ImageSharp; @@ -180,7 +179,6 @@ public static void MapAdditionalRoutes(IEndpointRouteBuilder parentRoute) // sfm.ObjectIndex.Objects.Add( // new ObjectIndexEntry(hdrs.S5.Name, saveFileName, tblObject.Id, hdrs.S5.Checksum, xxHash3, tblObject.ObjectType, tblObject.ObjectSource, tblObject.CreatedDate, tblObject.UploadedDate, tblObject.VehicleType)); - // _ = sfm.ObjectIndex.SaveIndexAsync(sfm.IndexFile); // return Results.Created($"Successfully added {tblObject.Name} with unique id {tblObject.Id}", tblObject.Id); //} @@ -339,12 +337,10 @@ static async Task CreateDatAsync(DtoObjectPost request, [FromServices] // save again _ = await db.SaveChangesAsync(); - // update server index + // update server index (in-memory projection; DB is source of truth) sfm.ObjectIndex.Objects.Add( new ObjectIndexEntry(hdrs.S5.Name, saveFileName, tblObject.Id, hdrs.S5.Checksum, xxHash3, tblObject.ObjectType, tblObject.ObjectSource, tblObject.CreatedDate, tblObject.UploadedDate, tblObject.VehicleType)); - _ = sfm.ObjectIndex.SaveIndexAsync(sfm.IndexFile); - var response = new ExpandedTbl(tblObject, [], [], []).ToDtoDescriptor(); return Results.Created($"Successfully added {tblObject.Name} with unique id {tblObject.Id}", response); } diff --git a/ObjectService/RouteHandlers/TableHandlers/RoleRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/RoleRouteHandler.cs index 2632ac08..2f402619 100644 --- a/ObjectService/RouteHandlers/TableHandlers/RoleRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/RoleRouteHandler.cs @@ -8,8 +8,8 @@ namespace ObjectService.RouteHandlers.TableHandlers; public class RoleRouteHandler - : BaseDataTableRouteHandler - , ITableRouteConfig + : BaseDataTableRouteHandler + , ITableRouteConfig { public static string GetBaseRoute() => RoutesV2.Roles; @@ -17,7 +17,7 @@ public static string GetBaseRoute() public static void MapRoutes(IEndpointRouteBuilder endpoints) => BaseTableRouteHandler.MapRoutes(endpoints); - public static DbSet GetTable(LocoDbContext db) + public static DbSet GetTable(IdentityContext db) => db.Roles; public static DtoRoleEntry ToDtoFunc(TblUserRole table) @@ -29,7 +29,7 @@ public static void UpdateFunc(DtoRoleEntry request, TblUserRole row) public static TblUserRole ToRowFunc(DtoRoleEntry request) => request.ToTable(); - public static bool TryValidateCreate(DtoRoleEntry request, [FromServices] LocoDbContext db, out IResult? result) + public static bool TryValidateCreate(DtoRoleEntry request, [FromServices] IdentityContext db, out IResult? result) { if (string.IsNullOrWhiteSpace(request.Name)) { diff --git a/ObjectService/RouteHandlers/TableHandlers/TagRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/TagRouteHandler.cs index 5e6ba337..0f0ed7ae 100644 --- a/ObjectService/RouteHandlers/TableHandlers/TagRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/TagRouteHandler.cs @@ -8,8 +8,8 @@ namespace ObjectService.RouteHandlers.TableHandlers; public class TagRouteHandler - : BaseDataTableRouteHandler - , ITableRouteConfig + : BaseDataTableRouteHandler + , ITableRouteConfig { public static string GetBaseRoute() => RoutesV2.Tags; diff --git a/ObjectService/RouteHandlers/TableHandlers/UserRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/UserRouteHandler.cs index 42ad0a49..944653f4 100644 --- a/ObjectService/RouteHandlers/TableHandlers/UserRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/UserRouteHandler.cs @@ -8,8 +8,8 @@ namespace ObjectService.RouteHandlers.TableHandlers; public class UserRouteHandler - : BaseDataTableRouteHandler - , ITableRouteConfig + : BaseDataTableRouteHandler + , ITableRouteConfig { public static string GetBaseRoute() => RoutesV2.Users; @@ -17,7 +17,7 @@ public static string GetBaseRoute() public static void MapRoutes(IEndpointRouteBuilder endpoints) => BaseTableRouteHandler.MapRoutes(endpoints); - public static DbSet GetTable(LocoDbContext db) + public static DbSet GetTable(IdentityContext db) => db.Users; public static DtoUserEntry ToDtoFunc(TblUser table) @@ -29,7 +29,7 @@ public static void UpdateFunc(DtoUserEntry request, TblUser row) public static TblUser ToRowFunc(DtoUserEntry request) => request.ToTable(); - public static bool TryValidateCreate([FromBody] DtoUserEntry request, [FromServices] LocoDbContext db, out IResult? result) + public static bool TryValidateCreate([FromBody] DtoUserEntry request, [FromServices] IdentityContext db, out IResult? result) { if (string.IsNullOrWhiteSpace(request.UserName)) { diff --git a/ObjectService/RouteHandlers/TableHandlers/V1RouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/V1RouteHandler.cs index dafd4bca..9bcb5c24 100644 --- a/ObjectService/RouteHandlers/TableHandlers/V1RouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/V1RouteHandler.cs @@ -12,7 +12,6 @@ using Definitions.ObjectModels.Types; using Definitions.SourceData; using Definitions.Web; -using Index; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using SixLabors.ImageSharp; diff --git a/ObjectService/ServerFolderManager.cs b/ObjectService/ServerFolderManager.cs index 41450a02..6a2ae2f7 100644 --- a/ObjectService/ServerFolderManager.cs +++ b/ObjectService/ServerFolderManager.cs @@ -1,5 +1,5 @@ -using Index; - +using Definitions; +using Definitions.Database; namespace ObjectService; public interface IServerFolderManager @@ -22,7 +22,6 @@ public class TestServerFolderManager : IServerFolderManager /// - SoundEffects /// - Tutorials /// - Objects -/// - objectIndex.json /// - Custom /// - ... /// - Original @@ -45,7 +44,7 @@ public class ServerFolderManager : IServerFolderManager { string RootDirectory { get; init; } - public ServerFolderManager(string rootDirectory) + public ServerFolderManager(string rootDirectory, string databasePath) { if (!Directory.Exists(rootDirectory)) { @@ -53,38 +52,20 @@ public ServerFolderManager(string rootDirectory) } RootDirectory = rootDirectory; + DatabasePath = databasePath; ILogger logger = new Common.Logging.Logger(); - var indexFile = Path.Combine(rootDirectory, ObjectsFolderName); try { - ObjectIndex = ObjectIndex.LoadOrCreateIndex(indexFile, logger)!; + using var db = LocoDbContext.GetDbFromFile(databasePath) + ?? throw new FileNotFoundException($"Database file not found: {databasePath}"); + ObjectIndex = ObjectIndex.FromDb(db); } catch (Exception ex) { - // Index file is corrupt or otherwise unreadable. Log the original failure - // before destroying the file so we can diagnose recurring corruption. - logger.LogError(ex, "Failed to load object index at \"{IndexFile}\"; deleting and recreating.", indexFile); - try - { - File.Delete(indexFile); - } - catch (Exception deleteEx) - { - logger.LogError(deleteEx, "Failed to delete corrupt index file \"{IndexFile}\".", indexFile); - throw; - } - - try - { - ObjectIndex = ObjectIndex.LoadOrCreateIndex(indexFile, logger)!; - } - catch (Exception retryEx) - { - logger.LogError(retryEx, "Failed to recreate object index at \"{IndexFile}\".", indexFile); - throw; - } + logger.LogError(ex, "Failed to build object index from database \"{DatabasePath}\".", databasePath); + throw; } ArgumentOutOfRangeException.ThrowIfNotEqual(true, Directory.Exists(ObjectsOriginalFolder), nameof(ObjectsOriginalFolder)); @@ -127,9 +108,11 @@ public ServerFolderManager(string rootDirectory) public const string SteamFolderName = "Steam"; public const string GoGFolderName = "GoG"; + + public string DatabasePath { get; init; } #region Objects - public string IndexFile => Path.Combine(RootDirectory, ObjectsFolderName, ObjectIndex.DefaultIndexFileName); + public string IndexFile => DatabasePath; public string ObjectsFolder => Path.Combine(RootDirectory, ObjectsFolderName); public string ObjectsOriginalFolder => Path.Combine(ObjectsFolder, OriginalFolderName); public string ObjectsCustomFolder => Path.Combine(ObjectsFolder, CustomFolderName); @@ -162,4 +145,35 @@ public ServerFolderManager(string rootDirectory) public string ScenariosSteamFolder => Path.Combine(ScenariosOriginalFolder, SteamFolderName); #endregion + + // Creates the entire folder tree expected by ServerFolderManager under the given root. + // Idempotent: existing folders are left untouched. Use this to bootstrap a fresh local + // objects root (eg the GUI's embedded backend) before constructing the manager. + public static void EnsureFolderStructure(string rootDirectory) + { + ArgumentException.ThrowIfNullOrWhiteSpace(rootDirectory); + + string[] required = + [ + Path.Combine(rootDirectory, ObjectsFolderName, OriginalFolderName), + Path.Combine(rootDirectory, ObjectsFolderName, CustomFolderName), + Path.Combine(rootDirectory, GameDataFolderName, GraphicsFolderName, OriginalFolderName), + Path.Combine(rootDirectory, GameDataFolderName, GraphicsFolderName, CustomFolderName), + Path.Combine(rootDirectory, GameDataFolderName, MusicFolderName, OriginalFolderName), + Path.Combine(rootDirectory, GameDataFolderName, MusicFolderName, CustomFolderName), + Path.Combine(rootDirectory, GameDataFolderName, SoundEffectsFolderName, OriginalFolderName), + Path.Combine(rootDirectory, GameDataFolderName, SoundEffectsFolderName, CustomFolderName), + Path.Combine(rootDirectory, GameDataFolderName, TutorialsFolderName, OriginalFolderName), + Path.Combine(rootDirectory, GameDataFolderName, TutorialsFolderName, CustomFolderName), + Path.Combine(rootDirectory, LandscapesFolderName), + Path.Combine(rootDirectory, ScenariosFolderName, OriginalFolderName, GoGFolderName), + Path.Combine(rootDirectory, ScenariosFolderName, OriginalFolderName, SteamFolderName), + Path.Combine(rootDirectory, ScenariosFolderName, CustomFolderName), + ]; + + foreach (var path in required) + { + _ = Directory.CreateDirectory(path); + } + } } diff --git a/Tests/Models/ViewModelTests.cs b/Tests/Models/ViewModelTests.cs index a7d5d635..2758ea87 100644 --- a/Tests/Models/ViewModelTests.cs +++ b/Tests/Models/ViewModelTests.cs @@ -1,7 +1,7 @@ +using Definitions; using Definitions.ObjectModels.Types; using Gui.Models; using Gui.ViewModels; -using Index; using NUnit.Framework; namespace Tests.Models; diff --git a/Tests/ObjectServiceIntegrationTests/Routes/ObjectPackRoutesTest.cs b/Tests/ObjectServiceIntegrationTests/Routes/ObjectPackRoutesTest.cs index 44c9ea11..3ce29ad2 100644 --- a/Tests/ObjectServiceIntegrationTests/Routes/ObjectPackRoutesTest.cs +++ b/Tests/ObjectServiceIntegrationTests/Routes/ObjectPackRoutesTest.cs @@ -5,7 +5,6 @@ using Definitions.DTO.Mappers; using Definitions.ObjectModels.Types; using Definitions.Web; -using Index; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; diff --git a/Tests/ObjectServiceIntegrationTests/Routes/ObjectRoutesTest.cs b/Tests/ObjectServiceIntegrationTests/Routes/ObjectRoutesTest.cs index 978e690f..bcbc7bce 100644 --- a/Tests/ObjectServiceIntegrationTests/Routes/ObjectRoutesTest.cs +++ b/Tests/ObjectServiceIntegrationTests/Routes/ObjectRoutesTest.cs @@ -7,7 +7,6 @@ using Definitions.DTO.Mappers; using Definitions.ObjectModels.Types; using Definitions.Web; -using Index; using Microsoft.EntityFrameworkCore; using NUnit.Framework; using ObjectService.Tests.Integration; @@ -172,7 +171,8 @@ public override async Task PostAsync() { var objDirectory = "Q:\\Games\\Locomotion\\Server\\Objects"; // this is naughty for a test but it'll do var logger = new Logger(); - var index = ObjectIndex.LoadOrCreateIndex(objDirectory, logger); + using var db = GetDbContext(); + var index = ObjectIndex.FromDb(db); _ = index.TryFind(7051740550869341430, out var entry); // randomly selected and hardcoded object Assert.That(entry, Is.Not.Null); From 108783c9d1d73c5de216b2a680e8826b8ce465f8 Mon Sep 17 00:00:00 2001 From: Benjamin Sutas Date: Thu, 28 May 2026 02:10:48 +1000 Subject: [PATCH 2/4] Implement folder indexing feature in ObjectService - Added FolderRouteHandler to handle folder indexing requests. - Implemented IndexFolderAsync method to scan and index folder contents. - Integrated folder indexing into the existing ObjectService routing. - Enhanced EmbeddedObjectServiceHost to manage shutdown behavior with a parent process watchdog. - Updated FilterViewModel to simplify filter expression building. - Refactored FolderTreeViewModel to remove local directory handling and improve online browsing logic. - Introduced reactive commands in MainWindowViewModel for folder indexing and local server log viewing. - Adjusted UI components in FolderTreeView and MainWindow to reflect changes in functionality and improve user experience. --- Definitions/DTO/DtoIndexFolderRequest.cs | 3 + Definitions/DTO/DtoIndexFolderResponse.cs | 8 + Definitions/ObjectIndex.cs | 7 +- Definitions/Web/Client.cs | 11 + Definitions/Web/RoutesV2.cs | 4 + Gui/App.axaml.cs | 54 ++- Gui/Models/FileSystemItems.cs | 12 +- Gui/Models/ObjectEditorContext.cs | 63 ++- Gui/Models/ObjectServiceModel.cs | 1 - Gui/ObjectServiceClient.cs | 3 + Gui/Services/EmbeddedObjectServiceHost.cs | 15 +- Gui/ViewModels/Filters/FilterViewModel.cs | 12 +- Gui/ViewModels/FolderTreeViewModel.cs | 411 +++++++++--------- Gui/ViewModels/MainWindowViewModel.cs | 64 ++- Gui/Views/FolderTreeView.axaml | 30 +- Gui/Views/MainWindow.axaml | 6 +- ObjectService/Hosting/ObjectServiceHost.cs | 17 + .../Hosting/ObjectServiceHostOptions.cs | 5 + .../Hosting/ParentProcessWatchdog.cs | 81 ++++ .../TableHandlers/FolderRouteHandler.cs | 69 +++ .../RouteHandlers/V1RouteBuilderExtensions.cs | 1 + 21 files changed, 585 insertions(+), 292 deletions(-) create mode 100644 Definitions/DTO/DtoIndexFolderRequest.cs create mode 100644 Definitions/DTO/DtoIndexFolderResponse.cs create mode 100644 ObjectService/Hosting/ParentProcessWatchdog.cs create mode 100644 ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs diff --git a/Definitions/DTO/DtoIndexFolderRequest.cs b/Definitions/DTO/DtoIndexFolderRequest.cs new file mode 100644 index 00000000..f8dca7b5 --- /dev/null +++ b/Definitions/DTO/DtoIndexFolderRequest.cs @@ -0,0 +1,3 @@ +namespace Definitions.DTO; + +public record DtoIndexFolderRequest(string Path); diff --git a/Definitions/DTO/DtoIndexFolderResponse.cs b/Definitions/DTO/DtoIndexFolderResponse.cs new file mode 100644 index 00000000..20009793 --- /dev/null +++ b/Definitions/DTO/DtoIndexFolderResponse.cs @@ -0,0 +1,8 @@ +namespace Definitions.DTO; + +public record DtoIndexFolderResponse( + string Path, + int ScannedCount, + int AddedCount, + int SkippedCount, + int FailedCount); diff --git a/Definitions/ObjectIndex.cs b/Definitions/ObjectIndex.cs index 98d9450c..448fdc17 100644 --- a/Definitions/ObjectIndex.cs +++ b/Definitions/ObjectIndex.cs @@ -4,10 +4,9 @@ namespace Definitions; -// Thin in-memory container of ObjectIndexEntry projections. The legacy -// JSON-on-disk implementation has been removed; the local client builds this -// from the SQLite DB (LocalObjectIndexService) and the server builds it from -// its own DB. Kept as a class so existing UI bindings on Objects remain valid. +// Thin in-memory container of ObjectIndexEntry projections. The local client +// builds this from the SQLite DB (LocalObjectIndexService) and the server builds +// it from its own DB. Kept as a class so existing UI bindings on Objects remain valid. public class ObjectIndex { public ObservableCollection Objects { get; init; } = []; diff --git a/Definitions/Web/Client.cs b/Definitions/Web/Client.cs index 2e3ef057..fe759120 100644 --- a/Definitions/Web/Client.cs +++ b/Definitions/Web/Client.cs @@ -144,4 +144,15 @@ public static async Task> GetSC5FilePacksAsync(Htt public static async Task> GetMissingObjectsAsync(HttpClient client, ILogger? logger = null) => await GetListAsync(client, MissingObjectsEndpointGroup, logger); + + public static async Task IndexFolderAsync(HttpClient client, string folderPath, ILogger? logger = null) + { + logger?.LogDebug("Posting index-folder request for \"{Path}\" to {BaseAddress}{Folders}{Index}", folderPath, client.BaseAddress?.OriginalString, RoutesV2.Folders, RoutesV2.Index); + return await ClientHelpers.PostAsync( + client, + ApiVersion, + RoutesV2.Folders + RoutesV2.Index, + new DtoIndexFolderRequest(folderPath), + logger); + } } diff --git a/Definitions/Web/RoutesV2.cs b/Definitions/Web/RoutesV2.cs index bff8c09f..ecfbb6ba 100644 --- a/Definitions/Web/RoutesV2.cs +++ b/Definitions/Web/RoutesV2.cs @@ -11,6 +11,10 @@ public static class RoutesV2 public const string Authors = "/authors"; public const string Tags = "/tags"; public const string Licences = "/licences"; + public const string Folders = "/folders"; + + // extra Folders routes + public const string Index = "/index"; // extra Objects routes public const string File = "/file"; diff --git a/Gui/App.axaml.cs b/Gui/App.axaml.cs index 1767afb7..8f783244 100644 --- a/Gui/App.axaml.cs +++ b/Gui/App.axaml.cs @@ -4,7 +4,9 @@ using Avalonia.Markup.Xaml; using Gui.ViewModels; using Gui.Views; +using System; using System.Collections.Generic; +using System.Threading; namespace Gui; @@ -22,23 +24,49 @@ public override void OnFrameworkInitializationCompleted() DataContext = mainVm, }; - // Ensure the embedded ObjectService (if started) and any other context-owned - // resources are cleaned up when the application is shutting down. - desktop.ShutdownRequested += (_, _) => - { - try - { - mainVm.EditorContext.DisposeAsync().AsTask().GetAwaiter().GetResult(); - } - catch - { - // best-effort: never throw from shutdown - } - }; + // The embedded ObjectService MUST NOT outlive the GUI under any circumstance + // (clean close, OS shutdown, crash, force-kill). We hook every realistic exit + // path; whichever fires first wins. ShutdownOnce makes the operation idempotent + // so duplicate triggers are harmless. + var shutdown = new ShutdownOnce(mainVm); + + desktop.ShutdownRequested += (_, _) => shutdown.Run(); + desktop.Exit += (_, _) => shutdown.Run(); + AppDomain.CurrentDomain.ProcessExit += (_, _) => shutdown.Run(); + AppDomain.CurrentDomain.UnhandledException += (_, _) => shutdown.Run(); } base.OnFrameworkInitializationCompleted(); } + + sealed class ShutdownOnce + { + readonly MainWindowViewModel mainVm; + int ran; + + public ShutdownOnce(MainWindowViewModel mainVm) => this.mainVm = mainVm; + + public void Run() + { + if (Interlocked.Exchange(ref ran, 1) != 0) + { + return; + } + + try + { + // Bound the wait so a misbehaving Kestrel stop can't hang the process + // indefinitely. 5s is well above normal Kestrel drain time. + var disposeTask = mainVm.EditorContext.DisposeAsync().AsTask(); + _ = disposeTask.Wait(TimeSpan.FromSeconds(5)); + } + catch + { + // best-effort: never throw from shutdown + } + } + } + public static IEnumerable GetOpenWindows() { if (Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) diff --git a/Gui/Models/FileSystemItems.cs b/Gui/Models/FileSystemItems.cs index 8f173685..a3f790ea 100644 --- a/Gui/Models/FileSystemItems.cs +++ b/Gui/Models/FileSystemItems.cs @@ -11,7 +11,7 @@ namespace Gui.Models; public record FileSystemItem( string DisplayName, string? FileName, // only available in local mode - UniqueObjectId? Id, // only available in online-mode + UniqueObjectId? Id, // only available in remote mode DateOnly? CreatedDate = null, DateOnly? ModifiedDate = null, FileLocationKind? FileLocation = null, @@ -26,11 +26,11 @@ public record FileSystemItem( [JsonIgnore] public bool CanOpen - => FileLocation == FileLocationKind.Local - || (FileLocation == FileLocationKind.Online - && OnlineApiEndpointGroup == OnlineApiEndpointGroupKind.Objects - && Id != null - && ObjectType != null); + // Items delivered by a server (any FileLocation) have an Id and are openable via + // the API; items without an Id are raw disk files from the file-open dialog and + // only openable when present on disk. + => (Id != null && ObjectType != null && OnlineApiEndpointGroup == OnlineApiEndpointGroupKind.Objects) + || (FileLocation == FileLocationKind.Local && Id == null && !string.IsNullOrEmpty(FileName)); [JsonIgnore] public bool CanDownload diff --git a/Gui/Models/ObjectEditorContext.cs b/Gui/Models/ObjectEditorContext.cs index 9569bcc4..867fef7f 100644 --- a/Gui/Models/ObjectEditorContext.cs +++ b/Gui/Models/ObjectEditorContext.cs @@ -34,7 +34,7 @@ public class ObjectEditorContext : IDisposable, IAsyncDisposable public Logger Logger { get; init; } - public ObjectIndex ObjectIndex { get; private set; } = new(); + public ObjectIndex ObjectIndex { get; set; } = new(); public ObjectIndex? ObjectIndexOnline { get; set; } @@ -64,8 +64,20 @@ public class ObjectEditorContext : IDisposable, IAsyncDisposable public ObservableCollection LoggerObservableLogs { get; init; } = []; + // Dedicated logger for the embedded ObjectService. Routed to its own observable + // collection so the local-server log popup shows only server-originated lines, + // while still writing to the shared on-disk log file (with a [LocalServer] tag). + public Logger LocalServerLogger { get; init; } + + public ObservableCollection LocalServerObservableLogs { get; init; } = []; + public ObjectServiceClient ObjectServiceClient { get; init; } + // Second client wired to the configured remote master ObjectService. The GUI talks to + // both clients via the same HTTP API so local and remote objects can be browsed + // uniformly; the only difference is which server answered the request. + public ObjectServiceClient RemoteObjectServiceClient { get; init; } + public ObjectServiceModel ObjectServiceModel { get; init; } // Always non-null. Reflects the lifecycle of the in-process ObjectService - the GUI's @@ -89,7 +101,11 @@ public ObjectEditorContext() { Logger = new Logger(); LoggerObservableLogs = []; - Logger.LogAdded += (sender, laea) => LogAsync(laea.Log).ConfigureAwait(false); + Logger.LogAdded += (sender, laea) => LogAsync(laea.Log, LoggerObservableLogs, tag: null).ConfigureAwait(false); + + LocalServerLogger = new Logger(); + LocalServerObservableLogs = []; + LocalServerLogger.LogAdded += (sender, laea) => LogAsync(laea.Log, LocalServerObservableLogs, tag: "LocalServer").ConfigureAwait(false); LoadSettings(); @@ -99,7 +115,7 @@ public ObjectEditorContext() Settings.CacheFolder = InitialiseDirectory(Settings.CacheFolder, "cache"); Settings.DownloadFolder = InitialiseDirectory(Settings.DownloadFolder, "downloads"); - LocalServerHost = new Gui.Services.EmbeddedObjectServiceHost(Logger); + LocalServerHost = new Gui.Services.EmbeddedObjectServiceHost(LocalServerLogger); // Make sure the host has a usable objects-root folder and palette file to point // at - even if the user hasn't filled them in. @@ -114,6 +130,10 @@ public ObjectEditorContext() ObjectServiceClient = new(Settings, Logger, localBaseAddress); ObjectServiceModel = new ObjectServiceModel(ObjectServiceClient, Logger); + // Remote master server: same client class, just pointed at the configured address. + // Passing null asks the client to resolve the base URL from EditorSettings. + RemoteObjectServiceClient = new(Settings, Logger, baseAddressOverride: null); + if (localBaseAddress is not null) { _ = Task.Run(() => StartLocalServerAsync(localBaseAddress)); @@ -279,6 +299,10 @@ async Task StartLocalServerAsync(Uri targetUri) HttpUrl = targetUri.ToString().TrimEnd('/'), JwtKey = EmbeddedObjectServiceHost.GenerateEphemeralJwtKey(), IsServer = false, + // Tie the embedded server's lifetime to this GUI process. In-process this is + // a no-op (same PID); if the host is ever re-architected as a child process + // the watchdog will reap it when the GUI dies. + ParentProcessId = Environment.ProcessId, }; await LocalServerHost.StartAsync(options); @@ -313,7 +337,8 @@ public async Task RestartLocalServerAsync() var newBaseAddress = PrepareLocalServerUri(); ObjectServiceClient.RetargetBaseAddress(newBaseAddress); - // Remote address may have changed via settings; re-point the monitor at the new URI. + // Remote address may have changed via settings; re-point the monitor and client at the new URI. + RemoteObjectServiceClient.RetargetBaseAddress(null); RemoteServerMonitor.Configure(GetRemoteServerUri()); if (newBaseAddress is not null) @@ -322,13 +347,16 @@ public async Task RestartLocalServerAsync() } } - public async Task LogAsync(LogLine log) + public Task LogAsync(LogLine log) => LogAsync(log, LoggerObservableLogs, tag: null); + + async Task LogAsync(LogLine log, ObservableCollection sink, string? tag) { // update UI - Dispatcher.UIThread.Post(() => LoggerObservableLogs.Insert(0, log)); + Dispatcher.UIThread.Post(() => sink.Insert(0, log)); - // update log file on disk - logQueue.Enqueue(log.ToString()); + // update log file on disk - prefix server lines so the merged file remains useful. + var text = tag is null ? log.ToString() : $"[{tag}] {log}"; + logQueue.Enqueue(text); await WriteLogsToFileAsync(); } @@ -404,7 +432,11 @@ public bool TryLoadObject(FileSystemItem filesystemItem, out LocoUIObjectModel? try { - var result = filesystemItem.FileLocation == FileLocation.Online + // Dispatch by data source rather than FileLocation: an item with an Id was + // produced by a server (local or remote) and must be fetched via the matching + // HTTP client. Items without an Id are raw disk files from the file-open + // dialog and load straight off disk. + var result = filesystemItem.Id != null ? TryLoadOnlineFile(filesystemItem, out uiLocoFile) : TryLoadLocalFile(filesystemItem, out uiLocoFile); @@ -449,19 +481,26 @@ bool TryLoadOnlineFile(FileSystemItem filesystemItem, out LocoUIObjectModel? loc if (!OnlineCache.TryGetValue(filesystemItem.Id.Value, out var cachedLocoObjDto)) // issue - if an object doesn't download its full file, it's 'header' will remain in cache but unable to attempt redownload { - Logger.LogDebug("Didn't find object {DisplayName} with unique id {Id} in cache - downloading it from {BaseAddress}", filesystemItem.DisplayName, filesystemItem.Id, ObjectServiceClient.WebClient.BaseAddress); + // Pick the client by FileLocation: Local items came from the embedded server, + // Online items came from the remote master. The GUI treats them uniformly, + // but each must round-trip back to its originating server. + var client = filesystemItem.FileLocation == FileLocation.Online + ? RemoteObjectServiceClient + : ObjectServiceClient; - if (ObjectServiceClient == null) + if (client == null) { Logger.LogError("Object service client is null"); return false; } + Logger.LogDebug("Didn't find object {DisplayName} with unique id {Id} in cache - downloading it from {BaseAddress}", filesystemItem.DisplayName, filesystemItem.Id, client.WebClient.BaseAddress); + // Synchronous bridge: TryLoadObject is a sync API used by many callers, so we must // block here. Task.Run pushes the await onto the thread pool (no captured UI // SynchronizationContext), avoiding the classic UI deadlock. GetAwaiter().GetResult() // is preferred over .Result so exceptions are not wrapped in AggregateException. - cachedLocoObjDto = Task.Run(() => ObjectServiceClient.GetObjectAsync(filesystemItem.Id.Value)).GetAwaiter().GetResult(); + cachedLocoObjDto = Task.Run(() => client.GetObjectAsync(filesystemItem.Id.Value)).GetAwaiter().GetResult(); if (cachedLocoObjDto == null) { diff --git a/Gui/Models/ObjectServiceModel.cs b/Gui/Models/ObjectServiceModel.cs index 2efee7ab..86d110c6 100644 --- a/Gui/Models/ObjectServiceModel.cs +++ b/Gui/Models/ObjectServiceModel.cs @@ -1,6 +1,5 @@ using Avalonia.Threading; using Definitions.DTO; -using Gui.Services; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; diff --git a/Gui/ObjectServiceClient.cs b/Gui/ObjectServiceClient.cs index bf22ffe7..42f09c9b 100644 --- a/Gui/ObjectServiceClient.cs +++ b/Gui/ObjectServiceClient.cs @@ -136,4 +136,7 @@ public async Task> GetSC5FilePacksAsync() public async Task> GetMissingObjectsAsync() => await Client.GetMissingObjectsAsync(WebClient, Logger); + + public async Task IndexFolderAsync(string folderPath) + => await Client.IndexFolderAsync(WebClient, folderPath, Logger); } diff --git a/Gui/Services/EmbeddedObjectServiceHost.cs b/Gui/Services/EmbeddedObjectServiceHost.cs index 439ce8e2..11015d66 100644 --- a/Gui/Services/EmbeddedObjectServiceHost.cs +++ b/Gui/Services/EmbeddedObjectServiceHost.cs @@ -155,7 +155,20 @@ public async Task StopAsync(CancellationToken cancellationToken = default) return; } - await app.StopAsync(cancellationToken); + // Cap Kestrel's shutdown drain so the GUI can never be held open by an + // in-flight request or a misbehaving connection. + using var stopCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + stopCts.CancelAfter(TimeSpan.FromSeconds(3)); + + try + { + await app.StopAsync(stopCts.Token); + } + catch (OperationCanceledException) + { + logger.LogWarning("Embedded ObjectService stop timed out; forcing dispose."); + } + await app.DisposeAsync(); app = null; BaseAddress = null; diff --git a/Gui/ViewModels/Filters/FilterViewModel.cs b/Gui/ViewModels/Filters/FilterViewModel.cs index 5f5a4f23..03322874 100644 --- a/Gui/ViewModels/Filters/FilterViewModel.cs +++ b/Gui/ViewModels/Filters/FilterViewModel.cs @@ -231,7 +231,7 @@ private static bool IsNumericType(Type type) return null; } - public Func? BuildExpression(bool isLocal) + public Func? BuildExpression() { if (SelectedProperty == null || SelectedObjectType == null) { @@ -248,7 +248,7 @@ private static bool IsNumericType(Type type) // return BuildFilterExpression()?.Compile(); //} // Otherwise, build a delegate that loads the object from disk - return entry => BuildObjectFilter(entry, isLocal); + return entry => BuildObjectFilter(entry); } //bool BuildMetadataFilter(ObjectIndexEntry entry) @@ -256,14 +256,8 @@ private static bool IsNumericType(Type type) // return BuildFilterExpression()?.Compile(); //} - bool BuildObjectFilter(FileSystemItem entry, bool isLocal) + bool BuildObjectFilter(FileSystemItem entry) { - if (!isLocal) - { - // online mode not supported yet - return false; - } - if (entry.ObjectType == null || SelectedObjectType == null || ObjectTypeMapping.StructTypeToObjectType(SelectedObjectType.Type) != entry.ObjectType) { return false; diff --git a/Gui/ViewModels/FolderTreeViewModel.cs b/Gui/ViewModels/FolderTreeViewModel.cs index 1c0caf04..9f5a88b4 100644 --- a/Gui/ViewModels/FolderTreeViewModel.cs +++ b/Gui/ViewModels/FolderTreeViewModel.cs @@ -37,8 +37,6 @@ public class DesignerFolderTreeViewModel : FolderTreeViewModel { public DesignerFolderTreeViewModel() { - IsLocal = true; - CurrentLocalDirectory = "test/directory"; CurrentDirectoryItems.AddRange( [ new( @@ -135,7 +133,6 @@ public class DesignerOnlineBrowseResultsViewModel : FolderTreeViewModel { public DesignerOnlineBrowseResultsViewModel() { - SelectedTabIndex = 1; SelectedOnlineBrowseTarget = new OnlineBrowseTargetOption(OnlineApiEndpointGroup.ObjectPacks, "Object packs", "Object packs", Client.ObjectPacksEndpointGroup); CurrentOnlineBrowseResults.Add(new OnlineItemPackBrowseResult( @@ -214,14 +211,6 @@ public void OnSelectionChanged(IReadOnlyList selectedItems) ObjectEditorContext EditorContext { get; init; } = null!; - [Reactive] - public string CurrentLocalDirectory { get; set; } = string.Empty; - public string CurrentDirectory => IsLocal - ? CurrentLocalDirectory - : EditorContext.Settings.UseHttps - ? EditorContext.Settings.ServerAddressHttps - : EditorContext.Settings.ServerAddressHttp; - [Reactive] public FileSystemItem? CurrentlySelectedObject { get; set; } @@ -231,7 +220,6 @@ public void OnSelectionChanged(IReadOnlyList selectedItems) Progress Progress { get; } = new(); public ReactiveCommand? RefreshDirectoryItems { get; } - public ReactiveCommand? OpenCurrentFolder { get; } public ReactiveCommand? OpenFolderFor { get; } public ReactiveCommand? SelectOnlineBrowseFileSystemItem { get; } public ReactiveCommand? DownloadOnlineItemCommand { get; private set; } @@ -251,42 +239,26 @@ public void OnSelectionChanged(IReadOnlyList selectedItems) new(OnlineApiEndpointGroup.MissingObjects, "Missing objects", "Missing objects", Client.MissingObjectsEndpointGroup), ]; - [Reactive] - public int SelectedTabIndex { get; set; } - [Reactive] public OnlineBrowseTargetOption SelectedOnlineBrowseTarget { get; set; } = ObjectOnlineBrowseTarget; - readonly Dictionary> onlineDirectoryItemsCache = []; - readonly Dictionary> onlineBrowseResultsCache = []; - - public bool IsLocal - { - get => SelectedTabIndex == 0; - set => SelectedTabIndex = value ? 0 : 1; - } + readonly Dictionary<(OnlineApiEndpointGroup Group, FileLocation Location), IReadOnlyList> onlineDirectoryItemsCache = []; + readonly Dictionary<(OnlineApiEndpointGroup Group, FileLocation Location), IReadOnlyList> onlineBrowseResultsCache = []; public string RecreateText - => IsLocal - ? "Recreate index" - : $"Download {CurrentItemLabelPlural.ToLowerInvariant()} list"; + => $"Refresh {CurrentItemLabelPlural.ToLowerInvariant()} list"; public string DirectoryFileCount => $"{CurrentItemLabelPlural}: {ResultsCount}"; public string CurrentItemLabelPlural - => IsLocal - ? "Objects" - : SelectedOnlineBrowseTarget?.ItemLabelPlural ?? "Items"; - - public bool IsOnline - => !IsLocal; + => SelectedOnlineBrowseTarget?.ItemLabelPlural ?? "Items"; public bool UsesTreeDataGrid - => IsLocal || SelectedOnlineBrowseTarget.Group is OnlineApiEndpointGroup.Objects or OnlineApiEndpointGroup.Scenarios; + => SelectedOnlineBrowseTarget.Group is OnlineApiEndpointGroup.Objects or OnlineApiEndpointGroup.Scenarios; public bool HasOnlineBrowseResults - => IsOnline && !UsesTreeDataGrid; + => !UsesTreeDataGrid; public bool SupportsFilters => UsesTreeDataGrid; @@ -327,15 +299,14 @@ public FolderTreeViewModel(ObjectEditorContext editorContext) } RefreshDirectoryItems = ReactiveCommand.CreateFromTask(async () => await LoadDirectoryAsync(false)); - OpenCurrentFolder = ReactiveCommand.Create(() => PlatformSpecific.FolderOpenInDesktop(IsLocal ? CurrentLocalDirectory : this.EditorContext.Settings.DownloadFolder, this.EditorContext.Logger)); AddFilterCommand = ReactiveCommand.Create(() => Filters.Add(new FilterViewModel(this.EditorContext, availableFilterCategories, RemoveFilter))); SelectOnlineBrowseFileSystemItem = ReactiveCommand.Create(item => CurrentlySelectedObject = item); DownloadOnlineItemCommand = ReactiveCommand.CreateFromTask(DownloadOnlineItemAsync); DownloadOnlinePackCommand = ReactiveCommand.CreateFromTask(DownloadOnlinePackAsync); OpenFolderFor = ReactiveCommand.Create((FileSystemItem clickedOn) => { - if (IsLocal - && clickedOn is FileSystemItem clickedOnObject + if ( + clickedOn is FileSystemItem clickedOnObject && clickedOnObject.FileLocation == FileLocation.Local && (clickedOnObject.SubNodes == null || clickedOnObject.SubNodes.Count == 0) && File.Exists(clickedOnObject.FileName)) @@ -380,16 +351,9 @@ public FolderTreeViewModel(ObjectEditorContext editorContext) .Subscribe(_ => UpdateDirectoryItemsView()) .DisposeWith(_subscriptions); - _ = this.WhenAnyValue(o => o.CurrentLocalDirectory).Skip(1).Subscribe(async _ => await LoadDirectoryAsync(true)).DisposeWith(_subscriptions); - _ = this.WhenAnyValue(o => o.CurrentLocalDirectory).Skip(1).Subscribe(_ => this.RaisePropertyChanged(nameof(CurrentDirectory))).DisposeWith(_subscriptions); - - //_ = this.WhenAnyValue(o => o.SelectedTabIndex).Skip(1).Subscribe(_ => UpdateDirectoryItemsView()); - _ = this.WhenAnyValue(o => o.SelectedTabIndex).Skip(1).Subscribe(_ => RaiseBrowseModeProperties()).DisposeWith(_subscriptions); - _ = this.WhenAnyValue(o => o.CurrentDirectory).Skip(1).Subscribe(async _ => await LoadDirectoryAsync(true)).DisposeWith(_subscriptions); _ = this.WhenAnyValue(o => o.CurrentDirectoryItems).Skip(1).Subscribe(_ => UpdateDirectoryItemsView()).DisposeWith(_subscriptions); _ = this.WhenAnyValue(o => o.SelectedOnlineBrowseTarget).Skip(1).Subscribe(async _ => { - RaiseBrowseModeProperties(); await LoadDirectoryAsync(false); }).DisposeWith(_subscriptions); @@ -397,11 +361,8 @@ public FolderTreeViewModel(ObjectEditorContext editorContext) { CurrentlySelectedObject = null; this.RaisePropertyChanged(nameof(TreeDataGridSourceCount)); - RaiseBrowseModeProperties(); }).DisposeWith(_subscriptions); - CurrentLocalDirectory = this.EditorContext.Settings.ObjDataDirectory; - // add default name filter var defaultFilter = new FilterViewModel(this.EditorContext, availableFilterCategories, RemoveFilter) { @@ -415,20 +376,6 @@ public FolderTreeViewModel(ObjectEditorContext editorContext) protected void RemoveFilter(FilterViewModel filter) => Filters.Remove(filter); - void RaiseBrowseModeProperties() - { - this.RaisePropertyChanged(nameof(DirectoryFileCount)); - this.RaisePropertyChanged(nameof(ResultsCount)); - this.RaisePropertyChanged(nameof(RecreateText)); - this.RaisePropertyChanged(nameof(CurrentDirectory)); - this.RaisePropertyChanged(nameof(CurrentItemLabelPlural)); - this.RaisePropertyChanged(nameof(IsOnline)); - this.RaisePropertyChanged(nameof(UsesTreeDataGrid)); - this.RaisePropertyChanged(nameof(HasOnlineBrowseResults)); - this.RaisePropertyChanged(nameof(SupportsFilters)); - this.RaisePropertyChanged(nameof(SupportsHierarchyCommands)); - } - // this needs to be async as it blocks the UI when building expressions is slow private Func CreateFilterPredicate() { @@ -438,7 +385,7 @@ private Func CreateFilterPredicate() { try { - var filterDelegate = filter.BuildExpression(IsLocal); + var filterDelegate = filter.BuildExpression(); if (filterDelegate != null) { filterDelegates.Add(filterDelegate); @@ -480,70 +427,181 @@ async Task LoadDirectoryAsync(bool useExistingIndex) { EditorContext.Logger.LogDebug("UseExistingIndex={UseExistingIndex}", useExistingIndex); - if (IsLocal) + CurrentOnlineBrowseResults.Clear(); + CurrentDirectoryItems.Clear(); + + if (Design.IsDesignMode) + { + // DO NOT WEB QUERY AT DESIGN TIME + return; + } + + // The GUI is provider-agnostic: every browse target is fetched from both the + // local backend and the remote master, then merged. Both servers expose the + // same HTTP API; whichever is reachable contributes whatever it has. + var sources = new (ObjectServiceClient? Client, FileLocation Location)[] + { + (EditorContext.ObjectServiceClient, FileLocation.Local), + (EditorContext.RemoteObjectServiceClient, FileLocation.Online), + }; + + if (UsesTreeDataGrid) { - // local - await LoadObjDirectoryAsync(CurrentLocalDirectory, useExistingIndex); + foreach (var (client, location) in sources) + { + try + { + var items = await GetTreeItemsAsync(client, location, useExistingIndex); + if (items.Count > 0) + { + CurrentDirectoryItems.AddRange(items); + } + } + catch (Exception ex) + { + EditorContext.Logger.LogDebug(ex, "Failed to fetch {Group} from {Location} server.", SelectedOnlineBrowseTarget.Group, location); + } + } + + UpdateDirectoryItemsView(); } - else // remote + else { - await LoadOnlineDirectoryAsync(useExistingIndex); + foreach (var (client, location) in sources) + { + try + { + var results = await GetBrowseResultsAsync(client, location, useExistingIndex); + if (results.Count > 0) + { + CurrentOnlineBrowseResults.AddRange(results); + } + } + catch (Exception ex) + { + EditorContext.Logger.LogDebug(ex, "Failed to fetch {Group} from {Location} server.", SelectedOnlineBrowseTarget.Group, location); + } + } } await EditorContext.CheckForDatFilesNotOnServer(); } - async Task LoadObjDirectoryAsync(string directory, bool useExistingIndex) + async Task> GetTreeItemsAsync(ObjectServiceClient? client, FileLocation fileLocation, bool useExistingIndex) { - EditorContext.Logger.LogDebug("Directory={Directory} UseExistingIndex={UseExistingIndex}", directory, useExistingIndex); - CurrentOnlineBrowseResults.Clear(); - - if (string.IsNullOrEmpty(directory) || !Directory.Exists(directory)) + if (client == null) { - CurrentDirectoryItems.Clear(); - return; + return []; } - await EditorContext.LoadObjDirectoryAsync(directory, Progress, useExistingIndex); + var selectedGroup = SelectedOnlineBrowseTarget.Group; + + // Objects flow through the shared ObjectIndex cache on EditorContext. + if (selectedGroup == OnlineApiEndpointGroup.Objects) + { + Action setCachedIndex = fileLocation == FileLocation.Local + ? idx => EditorContext.ObjectIndex = idx + : idx => EditorContext.ObjectIndexOnline = idx; + Func getCachedIndex = fileLocation == FileLocation.Local + ? () => EditorContext.ObjectIndex + : () => EditorContext.ObjectIndexOnline; + + return await GetObjectDirectoryItemsAsync(client, fileLocation, setCachedIndex, getCachedIndex, useExistingIndex); + } - if (EditorContext.ObjectIndex != null) + var cacheKey = (selectedGroup, fileLocation); + if (useExistingIndex && onlineDirectoryItemsCache.TryGetValue(cacheKey, out var existingItems)) { - var items = EditorContext.ObjectIndex.Objects.Where(x => (int)x.ObjectType < Limits.kMaxObjectTypes); - CurrentDirectoryItems.Clear(); - CurrentDirectoryItems.AddRange(items.Select(x => IndexEntryToFileSystemItem(x, directory, FileLocation.Local))); + return existingItems; } - UpdateDirectoryItemsView(); + IReadOnlyList items = selectedGroup switch + { + OnlineApiEndpointGroup.Scenarios => [.. (await client.GetListAsync(SelectedOnlineBrowseTarget.EndpointGroup)) + .OrderBy(x => x.Name) + .Select(CreateOnlineScenarioFileSystemItem)], + _ => throw new NotImplementedException($"Unsupported endpoint group: {selectedGroup}"), + }; + + onlineDirectoryItemsCache[cacheKey] = items; + return items; } - async Task LoadOnlineDirectoryAsync(bool useExistingIndex) + async Task> GetBrowseResultsAsync(ObjectServiceClient? client, FileLocation fileLocation, bool useExistingIndex) { - EditorContext.Logger.LogDebug("UseExistingIndex={UseExistingIndex}", useExistingIndex); - - if (Design.IsDesignMode) + if (client == null) { - // DO NOT WEB QUERY AT DESIGN TIME - return; + return []; } - if (UsesTreeDataGrid) + var selectedGroup = SelectedOnlineBrowseTarget.Group; + var cacheKey = (selectedGroup, fileLocation); + if (useExistingIndex && onlineBrowseResultsCache.TryGetValue(cacheKey, out var existingItems)) { - var items = await GetOnlineTreeItemsAsync(useExistingIndex); - CurrentOnlineBrowseResults.Clear(); - CurrentDirectoryItems.Clear(); - CurrentDirectoryItems.AddRange(items); + return existingItems; } - else + + IReadOnlyList items = selectedGroup switch { - var results = await GetOnlineBrowseResultsAsync(useExistingIndex); - CurrentDirectoryItems.Clear(); + OnlineApiEndpointGroup.ObjectPacks => [.. (await GetObjectPackBrowseResultsAsync(client)).Cast()], + OnlineApiEndpointGroup.SC5FilePacks => [.. (await GetSC5FilePackBrowseResultsAsync(client)).Cast()], + OnlineApiEndpointGroup.Tags => [.. (await client.GetTagsAsync()) + .OrderBy(x => x.Name) + .Select(x => (object)new OnlineTagBrowseResult(x.Id, x.Name))], + OnlineApiEndpointGroup.Authors => [.. (await client.GetAuthorsAsync()) + .OrderBy(x => x.Name) + .Select(x => (object)new OnlineAuthorBrowseResult(x.Id, x.Name))], + OnlineApiEndpointGroup.Licences => [.. (await client.GetLicencesAsync()) + .OrderBy(x => x.Name) + .Select(x => (object)new OnlineLicenceBrowseResult(x.Id, x.Name, x.Text))], + OnlineApiEndpointGroup.MissingObjects => [.. (await client.GetMissingObjectsAsync()) + .OrderBy(x => x.DatName) + .Select(x => (object)new OnlineMissingObjectBrowseResult(x.Id, x.DatName, x.DatChecksum, x.ObjectType))], + _ => throw new NotImplementedException($"Unsupported endpoint group: {selectedGroup}"), + }; - CurrentOnlineBrowseResults.Clear(); - CurrentOnlineBrowseResults.AddRange(results); + onlineBrowseResultsCache[cacheKey] = items; + return items; + } + async Task> GetObjectDirectoryItemsAsync( + ObjectServiceClient? client, + FileLocation fileLocation, + Action setCachedIndex, + Func getCachedIndex, + bool useExistingIndex) + { + if (client == null) + { + return []; } - //UpdateDirectoryItemsView(); + var cached = getCachedIndex(); + if (!useExistingIndex || cached == null) + { + var entries = (await client.GetListAsync(SelectedOnlineBrowseTarget.EndpointGroup)) + .Select(x => new ObjectIndexEntry( + x.DisplayName, + null, + x.Id, + x.DatChecksum, + null, + x.ObjectType, + x.ObjectSource, + x.CreatedDate, + x.ModifiedDate, + x.VehicleType)); + cached = new ObjectIndex(entries); + setCachedIndex(cached); + } + + var baseDir = fileLocation == FileLocation.Online + ? EditorContext.Settings.DownloadFolder + : EditorContext.Settings.DownloadFolder; + + return [.. cached.Objects + .Where(x => (int)x.ObjectType < Limits.kMaxObjectTypes) + .Select(x => IndexEntryToFileSystemItem(x, baseDir, fileLocation))]; } protected void UpdateDirectoryItemsView() @@ -574,17 +632,49 @@ public static FileSystemItem IndexEntryToFileSystemItem(ObjectIndexEntry x, stri { DatChecksum = x.DatChecksum, xxHash3 = x.xxHash3, - OnlineApiEndpointGroup = fileLocation == FileLocation.Online ? OnlineApiEndpointGroup.Objects : null, + // Both "Local" and "Online" entries are now delivered by an HTTP ObjectService; + // only the originating client differs. Tagging both with Objects lets the load + // path dispatch via API regardless of which server produced the entry. + OnlineApiEndpointGroup = OnlineApiEndpointGroup.Objects, }; } static List ConstructTreeView(IEnumerable items) { - if (!items.Any(x => x.ObjectType != null)) + var materialised = items as IReadOnlyCollection ?? [.. items]; + if (!materialised.Any(x => x.ObjectType != null)) + { + return [.. materialised.OrderBy(x => x.DisplayName)]; + } + + // Top-level grouping by FileLocation (Local / Online). Each group's children are the + // usual ObjectType -> [VehicleType ->] item hierarchy. We only emit the wrapping + // node for non-empty groups so the tree stays tidy if (for example) the remote + // master server is unreachable. + var result = new List(); + foreach (var locationGroup in materialised + .GroupBy(x => x.FileLocation) + .OrderBy(g => g.Key)) { - return [.. items.OrderBy(x => x.DisplayName)]; + var locationNodes = BuildObjectTypeNodes(locationGroup); + if (locationNodes.Count == 0) + { + continue; + } + + result.Add(new FileSystemItem( + locationGroup.Key.ToString() ?? string.Empty, + null, + null, + FileLocation: locationGroup.Key, + SubNodes: [.. locationNodes])); } + return result; + } + + static List BuildObjectTypeNodes(IEnumerable items) + { var result = new List(); var groupedObjects = items .Where(x => x.ObjectType != null) @@ -636,127 +726,30 @@ static List ConstructTreeView(IEnumerable items) return result; } - async Task> GetOnlineTreeItemsAsync(bool useExistingIndex) - { - if (EditorContext.ObjectServiceClient == null) - { - return []; - } - - var selectedGroup = SelectedOnlineBrowseTarget.Group; - if (useExistingIndex && onlineDirectoryItemsCache.TryGetValue(selectedGroup, out var existingItems)) - { - return existingItems; - } - - var items = selectedGroup switch - { - OnlineApiEndpointGroup.Objects => await GetOnlineObjectDirectoryItemsAsync(useExistingIndex), - OnlineApiEndpointGroup.Scenarios => [.. (await EditorContext.ObjectServiceClient.GetListAsync(SelectedOnlineBrowseTarget.EndpointGroup)) - .OrderBy(x => x.Name) - .Select(CreateOnlineScenarioFileSystemItem)], - _ => throw new NotImplementedException($"Unsupported endpoint group: {selectedGroup}"), - }; - - onlineDirectoryItemsCache[selectedGroup] = items; - return items; - } - - async Task> GetOnlineBrowseResultsAsync(bool useExistingIndex) + async Task> GetObjectPackBrowseResultsAsync(ObjectServiceClient client) { - if (EditorContext.ObjectServiceClient == null) - { - return []; - } - - var selectedGroup = SelectedOnlineBrowseTarget.Group; - if (useExistingIndex && onlineBrowseResultsCache.TryGetValue(selectedGroup, out var existingItems)) - { - return existingItems; - } - - IReadOnlyList items = selectedGroup switch - { - OnlineApiEndpointGroup.ObjectPacks => [.. (await GetOnlineObjectPackBrowseResultsAsync()).Cast()], - OnlineApiEndpointGroup.SC5FilePacks => [.. (await GetOnlineSC5FilePackBrowseResultsAsync()).Cast()], - OnlineApiEndpointGroup.Tags => [.. (await EditorContext.ObjectServiceClient.GetTagsAsync()) - .OrderBy(x => x.Name) - .Select(x => (object)new OnlineTagBrowseResult(x.Id, x.Name))], - OnlineApiEndpointGroup.Authors => [.. (await EditorContext.ObjectServiceClient.GetAuthorsAsync()) - .OrderBy(x => x.Name) - .Select(x => (object)new OnlineAuthorBrowseResult(x.Id, x.Name))], - OnlineApiEndpointGroup.Licences => [.. (await EditorContext.ObjectServiceClient.GetLicencesAsync()) - .OrderBy(x => x.Name) - .Select(x => (object)new OnlineLicenceBrowseResult(x.Id, x.Name, x.Text))], - OnlineApiEndpointGroup.MissingObjects => [.. (await EditorContext.ObjectServiceClient.GetMissingObjectsAsync()) - .OrderBy(x => x.DatName) - .Select(x => (object)new OnlineMissingObjectBrowseResult(x.Id, x.DatName, x.DatChecksum, x.ObjectType))], - _ => throw new NotImplementedException($"Unsupported endpoint group: {selectedGroup}"), - }; - - onlineBrowseResultsCache[selectedGroup] = items; - return items; - } - - async Task> GetOnlineObjectDirectoryItemsAsync(bool useExistingIndex) - { - if ((!useExistingIndex || EditorContext.ObjectIndexOnline == null) && EditorContext.ObjectServiceClient != null) - { - EditorContext.ObjectIndexOnline = new ObjectIndex((await EditorContext.ObjectServiceClient.GetListAsync(SelectedOnlineBrowseTarget.EndpointGroup)) - .Select(x => new ObjectIndexEntry( - x.DisplayName, - null, - x.Id, - x.DatChecksum, - null, - x.ObjectType, - x.ObjectSource, - x.CreatedDate, - x.ModifiedDate, - x.VehicleType))); - } - - return EditorContext.ObjectIndexOnline == null - ? [] - : [.. EditorContext.ObjectIndexOnline.Objects - .Where(x => (int)x.ObjectType < Limits.kMaxObjectTypes) - .Select(x => IndexEntryToFileSystemItem(x, EditorContext.Settings.DownloadFolder, FileLocation.Online))]; - } - - async Task> GetOnlineObjectPackBrowseResultsAsync() - { - if (EditorContext.ObjectServiceClient == null) - { - return []; - } - - var packs = (await EditorContext.ObjectServiceClient.GetObjectPacksAsync()) + var packs = (await client.GetObjectPacksAsync()) .OrderBy(x => x.Name) .ToList(); return [.. await Task.WhenAll(packs.Select(async pack => CreateOnlineItemPackBrowseResult( pack, - await EditorContext.ObjectServiceClient.GetObjectPackAsync(pack.Id), + await client.GetObjectPackAsync(pack.Id), OnlineApiEndpointGroup.ObjectPacks, descriptor => descriptor.Items.OrderBy(x => x.DisplayName).Select(CreateOnlineObjectFileSystemItem))))]; } - async Task> GetOnlineSC5FilePackBrowseResultsAsync() + async Task> GetSC5FilePackBrowseResultsAsync(ObjectServiceClient client) { - if (EditorContext.ObjectServiceClient == null) - { - return []; - } - - var packs = (await EditorContext.ObjectServiceClient.GetSC5FilePacksAsync()) + var packs = (await client.GetSC5FilePacksAsync()) .OrderBy(x => x.Name) .ToList(); return [.. await Task.WhenAll(packs.Select(async pack => CreateOnlineItemPackBrowseResult( pack, - await EditorContext.ObjectServiceClient.GetSC5FilePackAsync(pack.Id), + await client.GetSC5FilePackAsync(pack.Id), OnlineApiEndpointGroup.SC5FilePacks, descriptor => descriptor.Items.OrderBy(x => x.Name).Select(CreateOnlineScenarioFileSystemItem))))]; } @@ -823,15 +816,21 @@ static async Task ShowDownloadFailureDialogAsync(string contentMessage) async Task DownloadOnlineItemAsync(FileSystemItem item) { - if (EditorContext.ObjectServiceClient == null || item.Id == null) + // Download from whichever server produced the item; Local -> embedded server, + // Online -> remote master. Keeps the operation truly provider-agnostic. + var client = item.FileLocation == FileLocation.Online + ? EditorContext.RemoteObjectServiceClient + : EditorContext.ObjectServiceClient; + + if (client == null || item.Id == null) { return; } var fileBytes = item.OnlineApiEndpointGroup switch { - OnlineApiEndpointGroup.Objects => await EditorContext.ObjectServiceClient.GetObjectFileAsync(item.Id.Value), - OnlineApiEndpointGroup.Scenarios => await EditorContext.ObjectServiceClient.GetScenarioFileAsync(item.Id.Value), + OnlineApiEndpointGroup.Objects => await client.GetObjectFileAsync(item.Id.Value), + OnlineApiEndpointGroup.Scenarios => await client.GetScenarioFileAsync(item.Id.Value), _ => null, }; diff --git a/Gui/ViewModels/MainWindowViewModel.cs b/Gui/ViewModels/MainWindowViewModel.cs index f8b40644..80057193 100644 --- a/Gui/ViewModels/MainWindowViewModel.cs +++ b/Gui/ViewModels/MainWindowViewModel.cs @@ -55,6 +55,7 @@ public class MainWindowViewModel : ViewModelBase public ReactiveCommand UseCustomPalette { get; } public ReactiveCommand EditSettingsCommand { get; } public ReactiveCommand ShowLogsCommand { get; } + public ReactiveCommand ShowLocalServerLogsCommand { get; } public ReactiveCommand OpenDownloadLink { get; } public ReactiveCommand DownloadLatestUpdate { get; } @@ -189,6 +190,11 @@ public MainWindowViewModel() var vm = new LogWindowViewModel(EditorContext.LoggerObservableLogs); var result = await OpenLogWindow.Handle(vm); }); + ShowLocalServerLogsCommand = ReactiveCommand.CreateFromTask(async () => + { + var vm = new LogWindowViewModel(EditorContext.LocalServerObservableLogs); + var result = await OpenLogWindow.Handle(vm); + }); #region Version @@ -353,27 +359,27 @@ void PopulateObjDataMenu() { ObjDataItems.Clear(); - ObjDataItems.Add(new MenuItemViewModel("Add new folder", ReactiveCommand.Create(SelectNewFolder))); + ObjDataItems.Add(new MenuItemViewModel("Add new folder", ReactiveCommand.CreateFromTask(SelectNewFolder))); ObjDataItems.Add(new MenuItemViewModel("-", ReactiveCommand.Create(() => { }))); if (Directory.Exists(EditorContext.Settings.AppDataObjDataFolder)) { - ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.AppData)}] {EditorContext.Settings.AppDataObjDataFolder}", ReactiveCommand.Create(() => FolderTreeViewModel.CurrentLocalDirectory = EditorContext.Settings.AppDataObjDataFolder))); + ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.AppData)}] {EditorContext.Settings.AppDataObjDataFolder}", ReactiveCommand.CreateFromTask(() => IndexFolderViaServerAsync(EditorContext.Settings.AppDataObjDataFolder)))); } if (Directory.Exists(EditorContext.Settings.LocomotionSteamObjDataFolder)) { - ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.LocomotionSteam)}] {EditorContext.Settings.LocomotionSteamObjDataFolder}", ReactiveCommand.Create(() => FolderTreeViewModel.CurrentLocalDirectory = EditorContext.Settings.LocomotionSteamObjDataFolder))); + ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.LocomotionSteam)}] {EditorContext.Settings.LocomotionSteamObjDataFolder}", ReactiveCommand.CreateFromTask(() => IndexFolderViaServerAsync(EditorContext.Settings.LocomotionSteamObjDataFolder)))); } if (Directory.Exists(EditorContext.Settings.LocomotionGoGObjDataFolder)) { - ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.LocomotionGoG)}] {EditorContext.Settings.LocomotionGoGObjDataFolder}", ReactiveCommand.Create(() => FolderTreeViewModel.CurrentLocalDirectory = EditorContext.Settings.LocomotionGoGObjDataFolder))); + ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.LocomotionGoG)}] {EditorContext.Settings.LocomotionGoGObjDataFolder}", ReactiveCommand.CreateFromTask(() => IndexFolderViaServerAsync(EditorContext.Settings.LocomotionGoGObjDataFolder)))); } if (Directory.Exists(EditorContext.Settings.OpenLocoObjDataFolder)) { - ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.OpenLoco)}] {EditorContext.Settings.OpenLocoObjDataFolder}", ReactiveCommand.Create(() => FolderTreeViewModel.CurrentLocalDirectory = EditorContext.Settings.OpenLocoObjDataFolder))); + ObjDataItems.Add(new MenuItemViewModel($"[{nameof(GameObjDataFolder.OpenLoco)}] {EditorContext.Settings.OpenLocoObjDataFolder}", ReactiveCommand.CreateFromTask(() => IndexFolderViaServerAsync(EditorContext.Settings.OpenLocoObjDataFolder)))); } ObjDataItems.Add(new MenuItemViewModel("-", ReactiveCommand.Create(() => { }))); @@ -383,7 +389,43 @@ void PopulateObjDataMenu() EditorContext.Settings.ObjDataDirectories .Select(x => new MenuItemViewModel( x, - ReactiveCommand.Create(() => FolderTreeViewModel.CurrentLocalDirectory = x)))); + ReactiveCommand.CreateFromTask(() => IndexFolderViaServerAsync(x))))); + } + + // POSTs the folder path to the local ObjectService so the server can index + // the contents into its database, then asks the folder tree to refresh. + async Task IndexFolderViaServerAsync(string folderPath) + { + if (string.IsNullOrWhiteSpace(folderPath)) + { + return; + } + + try + { + EditorContext.Logger.LogInformation("Requesting local server to index folder \"{Path}\"", folderPath); + var response = await EditorContext.ObjectServiceClient.IndexFolderAsync(folderPath); + if (response is null) + { + EditorContext.Logger.LogWarning("Local server returned no response when indexing folder \"{Path}\"", folderPath); + return; + } + + EditorContext.Logger.LogInformation( + "Indexed folder \"{Path}\": scanned={Scanned} added={Added} skipped={Skipped} failed={Failed}", + response.Path, response.ScannedCount, response.AddedCount, response.SkippedCount, response.FailedCount); + } + catch (Exception ex) + { + EditorContext.Logger.LogError(ex, "Failed to request indexing of folder \"{Path}\"", folderPath); + return; + } + + // Refresh the tree so the new entries show up. + if (FolderTreeViewModel.RefreshDirectoryItems is { } refresh) + { + _ = refresh.Execute().Subscribe(); + } } public static async Task GetFileSystemItemFromUser(IReadOnlyList filetypes) @@ -568,11 +610,15 @@ public async Task SelectNewFolder() return; } - FolderTreeViewModel.CurrentLocalDirectory = dirPath; // this will cause the reindexing + // Persist the new directory and ask the local server to index it. + EditorContext.Settings.ObjDataDirectories.Add(dirPath); + EditorContext.Settings.Save(ObjectEditorContext.SettingsFile, EditorContext.Logger); + + await IndexFolderViaServerAsync(dirPath); + var menuItem = new MenuItemViewModel( dirPath, - ReactiveCommand.Create(() => FolderTreeViewModel.CurrentLocalDirectory = dirPath) - /*ReactiveCommand.Create(() => ObjDataItems.RemoveAt(ObjDataItems.Count))*/); + ReactiveCommand.CreateFromTask(() => IndexFolderViaServerAsync(dirPath))); ObjDataItems.Add(menuItem); } diff --git a/Gui/Views/FolderTreeView.axaml b/Gui/Views/FolderTreeView.axaml index cce896d2..386c4648 100644 --- a/Gui/Views/FolderTreeView.axaml +++ b/Gui/Views/FolderTreeView.axaml @@ -22,39 +22,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ObjectService/Hosting/ObjectServiceHost.cs b/ObjectService/Hosting/ObjectServiceHost.cs index 3a15c189..dae4a2e2 100644 --- a/ObjectService/Hosting/ObjectServiceHost.cs +++ b/ObjectService/Hosting/ObjectServiceHost.cs @@ -48,6 +48,11 @@ public static void ApplyOptionsToConfiguration(WebApplicationBuilder builder, Ob overrides["Kestrel:Endpoints:HttpsDefaultCert:Url"] = options.HttpsUrl; } + if (options.ParentProcessId is int pid) + { + overrides["ObjectService:ParentProcessId"] = pid.ToString(); + } + _ = builder.Configuration.AddInMemoryCollection(overrides); } @@ -153,6 +158,18 @@ public static void ConfigureBuilder(WebApplicationBuilder builder) _ = builder.Services.AddScoped(); _ = builder.Services.AddDatabaseDeveloperPageExceptionFilter(); + // Parent-process watchdog: if the owning GUI process goes away (clean exit or + // crash), this hosted service triggers IHostApplicationLifetime.StopApplication + // so the embedded server cannot keep listening. + var parentPid = builder.Configuration.GetValue("ObjectService:ParentProcessId"); + if (parentPid is int pid) + { + _ = builder.Services.AddHostedService(sp => new ParentProcessWatchdog( + pid, + sp.GetRequiredService(), + sp.GetRequiredService>())); + } + var objRoot = builder.Configuration["ObjectService:RootFolder"]; var paletteMapFile = builder.Configuration["ObjectService:PaletteMapFile"]; ArgumentNullException.ThrowIfNull(objRoot); diff --git a/ObjectService/Hosting/ObjectServiceHostOptions.cs b/ObjectService/Hosting/ObjectServiceHostOptions.cs index d765b1a6..4bf69a9e 100644 --- a/ObjectService/Hosting/ObjectServiceHostOptions.cs +++ b/ObjectService/Hosting/ObjectServiceHostOptions.cs @@ -39,4 +39,9 @@ public sealed record ObjectServiceHostOptions // False for the embedded GUI host: uses ClientLocoDbContext and skips Identity // migration entirely, so client databases never get the server-only Identity tables. public bool IsServer { get; init; } = true; + + // PID of the process that owns this host. When set to a PID other than the current + // process, a watchdog hosted service polls it; if the parent goes away the embedded + // server stops itself so it can never outlive its owner. + public int? ParentProcessId { get; init; } } diff --git a/ObjectService/Hosting/ParentProcessWatchdog.cs b/ObjectService/Hosting/ParentProcessWatchdog.cs new file mode 100644 index 00000000..30478d40 --- /dev/null +++ b/ObjectService/Hosting/ParentProcessWatchdog.cs @@ -0,0 +1,81 @@ +using System.Diagnostics; + +namespace ObjectService.Hosting; + +// Watches a parent process. If it disappears (the GUI crashes, is task-killed, or +// otherwise exits without cleanly stopping us) we trigger application shutdown so the +// embedded ObjectService cannot outlive its owner. +// +// When the configured parent PID matches the current process (the in-process embedded +// host case) the watchdog effectively becomes a no-op: we still poll, but the parent +// is always alive because it is us. +sealed class ParentProcessWatchdog : BackgroundService +{ + readonly int parentProcessId; + readonly IHostApplicationLifetime lifetime; + readonly ILogger logger; + + public ParentProcessWatchdog(int parentProcessId, IHostApplicationLifetime lifetime, ILogger logger) + { + this.parentProcessId = parentProcessId; + this.lifetime = lifetime; + this.logger = logger; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + // PID == current means in-process embedded host; no parent to monitor. + if (parentProcessId == Environment.ProcessId) + { + return; + } + + Process? parent; + try + { + parent = Process.GetProcessById(parentProcessId); + } + catch (ArgumentException) + { + logger.LogWarning("Parent process {Pid} not found at startup; shutting down.", parentProcessId); + lifetime.StopApplication(); + return; + } + + try + { + parent.EnableRaisingEvents = true; + logger.LogInformation("Watching parent process {Pid} ({Name}). Will shut down when it exits.", parentProcessId, parent.ProcessName); + + // Race: explicit shutdown vs parent exit. Whichever wins, we exit. + using var parentExited = new CancellationTokenSource(); + parent.Exited += (_, _) => parentExited.Cancel(); + + // Edge: parent already exited between GetProcessById and EnableRaisingEvents. + if (parent.HasExited) + { + parentExited.Cancel(); + } + + using var linked = CancellationTokenSource.CreateLinkedTokenSource(stoppingToken, parentExited.Token); + try + { + await Task.Delay(Timeout.Infinite, linked.Token); + } + catch (OperationCanceledException) + { + // fall through + } + + if (parentExited.IsCancellationRequested) + { + logger.LogWarning("Parent process {Pid} exited; stopping embedded ObjectService.", parentProcessId); + lifetime.StopApplication(); + } + } + finally + { + parent.Dispose(); + } + } +} diff --git a/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs new file mode 100644 index 00000000..0a63fba4 --- /dev/null +++ b/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs @@ -0,0 +1,69 @@ +using Dat.Services; +using Definitions.Database; +using Definitions.DTO; +using Definitions.Web; +using Microsoft.AspNetCore.Mvc; + +namespace ObjectService.RouteHandlers.TableHandlers; + +public static class FolderRouteHandler +{ + // Marker type used only as a logger category, because static classes cannot + // be used as the type argument for ILogger. + public sealed class LoggerCategory { } + + public static void MapRoutes(IEndpointRouteBuilder parentRoute) + { + var group = parentRoute.MapGroup(RoutesV2.Folders); + _ = group.MapPost(RoutesV2.Index, IndexFolderAsync); + } + + public static async Task IndexFolderAsync( + DtoIndexFolderRequest request, + [FromServices] ServerFolderManager sfm, + [FromServices] ILogger logger, + CancellationToken cancellationToken) + { + if (string.IsNullOrWhiteSpace(request?.Path)) + { + return Results.Problem("Path is required.", statusCode: StatusCodes.Status400BadRequest); + } + + var path = request.Path; + if (!Directory.Exists(path)) + { + return Results.Problem($"Directory does not exist on the server: {path}", statusCode: StatusCodes.Status404NotFound); + } + + logger.LogInformation("[IndexFolder] Indexing folder \"{Path}\"", path); + + LocoDbContext ContextFactory() => LocoDbContext.GetDbFromFile(sfm.DatabasePath) + ?? throw new FileNotFoundException($"Database file not found: {sfm.DatabasePath}"); + + // Scan the directory once so we can report scanned/failed counts. + var scan = await DatFolderScanner.ScanDirectoryAsync(path, logger, progress: null, cancellationToken); + + HashSet existingHashes; + await using (var db = ContextFactory()) + { + existingHashes = [.. db.DatObjects.Select(d => d.xxHash3)]; + } + + var succeededHashes = scan.Succeeded.Select(r => r.xxHash3).Distinct().ToList(); + var addedCount = succeededHashes.Count(h => !existingHashes.Contains(h)); + var skippedCount = succeededHashes.Count - addedCount; + + // Hand off to the index service for the additive insert. Existing hashes + // are skipped inside the service. + var indexService = new LocalObjectIndexService(ContextFactory, logger); + var relativeFiles = scan.Succeeded.Select(r => r.RelativePath).ToList(); + await indexService.AddFilesAsync(path, relativeFiles, progress: null, cancellationToken); + + var scannedCount = scan.Succeeded.Count + scan.Failed.Count; + logger.LogInformation( + "[IndexFolder] Done. Scanned={Scanned} Added={Added} Skipped={Skipped} Failed={Failed}", + scannedCount, addedCount, skippedCount, scan.Failed.Count); + + return Results.Ok(new DtoIndexFolderResponse(path, scannedCount, addedCount, skippedCount, scan.Failed.Count)); + } +} diff --git a/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs b/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs index f2513a41..9c37a42b 100644 --- a/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs +++ b/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs @@ -38,6 +38,7 @@ static IEndpointConventionBuilder MapServerRoutes(this IEndpointRouteBuilder end ScenarioRouteHandler.MapRoutes(routeGroup); SC5FilePackRouteHandler.MapRoutes(routeGroup); ObjectPackRouteHandler.MapRoutes(routeGroup); + FolderRouteHandler.MapRoutes(routeGroup); return routeGroup; } From 12c2b509caca022ca1c9bb2001dd914108f7ee1e Mon Sep 17 00:00:00 2001 From: Benjamin Sutas Date: Thu, 28 May 2026 10:37:43 +1000 Subject: [PATCH 3/4] feat: Add FileName column to DatObjects and implement DatFolderScanner service - Added a new column "FileName" to the DatObjects table in the database. - Introduced DatFolderScanner service to scan .dat files and return results. - Created DatFileScanResult and DatFolderScanResults records to encapsulate scan results. - Updated LocalObjectIndexService to rebuild the object index from scanned .dat files. - Refactored logging to integrate with the GUI's logging system. - Updated various view models to utilize the new scanning service. --- Dat/Dat.csproj | 6 + DatabaseTools/DatabaseTools.csproj | 1 + .../Services/DatabaseImportService.cs | 3 +- .../Identity/20260527111450_Initial.cs | 434 +- .../Migrations/Loco/20260527112357_Initial.cs | 3904 ++++++++--------- .../20260527120443_AddDatObjectFileName.cs | 42 +- Gui/Models/ObjectEditorContext.cs | 9 +- Gui/Services/CommonLoggerProvider.cs | 58 + Gui/Services/EmbeddedObjectServiceHost.cs | 10 +- Gui/ViewModels/Loco/SCV5ViewModel.cs | 3 +- .../RequiredObjectsListViewModel.cs | 3 +- .../TableHandlers/FolderRouteHandler.cs | 2 +- ObjectService/Services/DatFileScanResult.cs | 20 + .../Services/DatFolderScanResults.cs | 5 + .../Services/DatFolderScanner.cs | 23 +- .../Services/LocalObjectIndexService.cs | 5 +- 16 files changed, 2302 insertions(+), 2226 deletions(-) create mode 100644 Gui/Services/CommonLoggerProvider.cs create mode 100644 ObjectService/Services/DatFileScanResult.cs create mode 100644 ObjectService/Services/DatFolderScanResults.cs rename {Dat => ObjectService}/Services/DatFolderScanner.cs (84%) rename {Dat => ObjectService}/Services/LocalObjectIndexService.cs (98%) diff --git a/Dat/Dat.csproj b/Dat/Dat.csproj index eda5c6f7..69ab13f1 100644 --- a/Dat/Dat.csproj +++ b/Dat/Dat.csproj @@ -10,6 +10,12 @@ true + + + + + + diff --git a/DatabaseTools/DatabaseTools.csproj b/DatabaseTools/DatabaseTools.csproj index 4472fde6..de2c7677 100644 --- a/DatabaseTools/DatabaseTools.csproj +++ b/DatabaseTools/DatabaseTools.csproj @@ -26,6 +26,7 @@ + diff --git a/DatabaseTools/Services/DatabaseImportService.cs b/DatabaseTools/Services/DatabaseImportService.cs index 1e680a94..82d52dbb 100644 --- a/DatabaseTools/Services/DatabaseImportService.cs +++ b/DatabaseTools/Services/DatabaseImportService.cs @@ -6,6 +6,7 @@ using Definitions.ObjectModels.Types; using Definitions.SourceData; using Microsoft.EntityFrameworkCore; +using ObjectService.Services; using System.Text.Json; using System.Text.Json.Serialization; @@ -142,7 +143,7 @@ public static Task SeedAllAsync(ToolsSettings settings, Action log) if (!db.Objects.Any() && File.Exists(objectMetadataJson) && Directory.Exists(settings.ObjectDirectory)) { log("Seeding Objects"); - var scan = Dat.Services.DatFolderScanner.ScanDirectory(settings.ObjectDirectory, logger); + var scan = DatFolderScanner.ScanDirectory(settings.ObjectDirectory, logger); var objectMetadata = JsonSerializer.Deserialize>(File.ReadAllText(objectMetadataJson), jsonOptions); var objectMetadataDict = objectMetadata!.ToDictionary(x => x.InternalName, x => x); var gameReleaseDate = new DateOnly(2004, 09, 07); diff --git a/Definitions/Migrations/Identity/20260527111450_Initial.cs b/Definitions/Migrations/Identity/20260527111450_Initial.cs index d114d5cc..7f98fabb 100644 --- a/Definitions/Migrations/Identity/20260527111450_Initial.cs +++ b/Definitions/Migrations/Identity/20260527111450_Initial.cs @@ -4,221 +4,221 @@ namespace Definitions.Migrations.Identity { - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - AssociatedAuthorId = table.Column(type: "INTEGER", nullable: true), - UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), - Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoleId = table.Column(type: "INTEGER", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(type: "INTEGER", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "TEXT", nullable: false), - ProviderKey = table.Column(type: "TEXT", nullable: false), - ProviderDisplayName = table.Column(type: "TEXT", nullable: true), - UserId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "INTEGER", nullable: false), - RoleId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "INTEGER", nullable: false), - LoginProvider = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - } - } + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AssociatedAuthorId = table.Column(type: "INTEGER", nullable: true), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", nullable: true), + SecurityStamp = table.Column(type: "TEXT", nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), + PhoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(type: "INTEGER", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(type: "INTEGER", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "TEXT", nullable: false), + ProviderKey = table.Column(type: "TEXT", nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "INTEGER", nullable: false), + RoleId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "INTEGER", nullable: false), + LoginProvider = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + } + } } diff --git a/Definitions/Migrations/Loco/20260527112357_Initial.cs b/Definitions/Migrations/Loco/20260527112357_Initial.cs index c69ed0b1..1db2e0a9 100644 --- a/Definitions/Migrations/Loco/20260527112357_Initial.cs +++ b/Definitions/Migrations/Loco/20260527112357_Initial.cs @@ -4,2013 +4,2013 @@ namespace Definitions.Migrations.Loco { - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Authors", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Authors", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Licences", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Text = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Licences", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ObjectsMissing", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DatName = table.Column(type: "TEXT", nullable: false), - DatChecksum = table.Column(type: "INTEGER", nullable: false), - ObjectType = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjectsMissing", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Tags", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Tags", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ObjectPacks", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") - }, - constraints: table => - { - table.PrimaryKey("PK_ObjectPacks", x => x.Id); - table.ForeignKey( - name: "FK_ObjectPacks_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Objects", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - SubObjectId = table.Column(type: "INTEGER", nullable: false), - ObjectType = table.Column(type: "INTEGER", nullable: false), - ObjectSource = table.Column(type: "INTEGER", nullable: false), - VehicleType = table.Column(type: "INTEGER", nullable: true), - Availability = table.Column(type: "INTEGER", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") - }, - constraints: table => - { - table.PrimaryKey("PK_Objects", x => x.Id); - table.ForeignKey( - name: "FK_Objects_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "SC5FilePacks", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") - }, - constraints: table => - { - table.PrimaryKey("PK_SC5FilePacks", x => x.Id); - table.ForeignKey( - name: "FK_SC5FilePacks_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "SC5Files", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ObjectSource = table.Column(type: "INTEGER", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Description = table.Column(type: "TEXT", nullable: true), - LicenceId = table.Column(type: "INTEGER", nullable: true), - CreatedDate = table.Column(type: "TEXT", nullable: true), - ModifiedDate = table.Column(type: "TEXT", nullable: true), - UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") - }, - constraints: table => - { - table.PrimaryKey("PK_SC5Files", x => x.Id); - table.ForeignKey( - name: "FK_SC5Files_Licences_LicenceId", - column: x => x.LicenceId, - principalTable: "Licences", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "TblAuthorTblObjectPack", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - ObjectPacksId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblAuthorTblObjectPack", x => new { x.AuthorsId, x.ObjectPacksId }); - table.ForeignKey( - name: "FK_TblAuthorTblObjectPack_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblAuthorTblObjectPack_ObjectPacks_ObjectPacksId", - column: x => x.ObjectPacksId, - principalTable: "ObjectPacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblObjectPackTblTag", - columns: table => new - { - ObjectPacksId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblObjectPackTblTag", x => new { x.ObjectPacksId, x.TagsId }); - table.ForeignKey( - name: "FK_TblObjectPackTblTag_ObjectPacks_ObjectPacksId", - column: x => x.ObjectPacksId, - principalTable: "ObjectPacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblObjectPackTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "DatObjects", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DatName = table.Column(type: "TEXT", nullable: false), - DatChecksum = table.Column(type: "INTEGER", nullable: false), - xxHash3 = table.Column(type: "INTEGER", nullable: false), - ObjectId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DatObjects", x => x.Id); - table.ForeignKey( - name: "FK_DatObjects_Objects_ObjectId", - column: x => x.ObjectId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjAirport", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - LargeTiles = table.Column(type: "INTEGER", nullable: false), - MinX = table.Column(type: "INTEGER", nullable: false), - MinY = table.Column(type: "INTEGER", nullable: false), - MaxX = table.Column(type: "INTEGER", nullable: false), - MaxY = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjAirport", x => x.Id); - table.ForeignKey( - name: "FK_ObjAirport_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjBridge", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Flags = table.Column(type: "INTEGER", nullable: false), - ClearHeight = table.Column(type: "INTEGER", nullable: false), - DeckDepth = table.Column(type: "INTEGER", nullable: false), - SpanLength = table.Column(type: "INTEGER", nullable: false), - PillarSpacing = table.Column(type: "INTEGER", nullable: false), - MaxSpeed = table.Column(type: "INTEGER", nullable: false), - MaxHeight = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - BaseCostFactor = table.Column(type: "INTEGER", nullable: false), - HeightCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - DisabledTrackFlags = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjBridge", x => x.Id); - table.ForeignKey( - name: "FK_ObjBridge_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjBuilding", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - DemolishRatingReduction = table.Column(type: "INTEGER", nullable: false), - ScaffoldingSegmentType = table.Column(type: "INTEGER", nullable: false), - ScaffoldingColour = table.Column(type: "INTEGER", nullable: false), - Colours = table.Column(type: "INTEGER", nullable: false), - GeneratorFunction = table.Column(type: "INTEGER", nullable: false), - AverageNumberOnMap = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjBuilding", x => x.Id); - table.ForeignKey( - name: "FK_ObjBuilding_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjCargo", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CargoTransferTime = table.Column(type: "INTEGER", nullable: false), - CargoCategory = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - NumPlatformVariations = table.Column(type: "INTEGER", nullable: false), - StationCargoDensity = table.Column(type: "INTEGER", nullable: false), - PremiumDays = table.Column(type: "INTEGER", nullable: false), - MaxNonPremiumDays = table.Column(type: "INTEGER", nullable: false), - NonPremiumRate = table.Column(type: "INTEGER", nullable: false), - PenaltyRate = table.Column(type: "INTEGER", nullable: false), - PaymentFactor = table.Column(type: "INTEGER", nullable: false), - PaymentIndex = table.Column(type: "INTEGER", nullable: false), - UnitSize = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjCargo", x => x.Id); - table.ForeignKey( - name: "FK_ObjCargo_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjCliffEdge", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjCliffEdge", x => x.Id); - table.ForeignKey( - name: "FK_ObjCliffEdge_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjClimate", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - FirstSeason = table.Column(type: "INTEGER", nullable: false), - WinterSnowLine = table.Column(type: "INTEGER", nullable: false), - SummerSnowLine = table.Column(type: "INTEGER", nullable: false), - SeasonLength1 = table.Column(type: "INTEGER", nullable: false), - SeasonLength2 = table.Column(type: "INTEGER", nullable: false), - SeasonLength3 = table.Column(type: "INTEGER", nullable: false), - SeasonLength4 = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjClimate", x => x.Id); - table.ForeignKey( - name: "FK_ObjClimate_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjCompetitor", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - AvailableNamePrefixes = table.Column(type: "INTEGER", nullable: false), - AvailablePlaystyles = table.Column(type: "INTEGER", nullable: false), - Emotions = table.Column(type: "INTEGER", nullable: false), - Intelligence = table.Column(type: "INTEGER", nullable: false), - Aggressiveness = table.Column(type: "INTEGER", nullable: false), - Competitiveness = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjCompetitor", x => x.Id); - table.ForeignKey( - name: "FK_ObjCompetitor_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjCurrency", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Separator = table.Column(type: "INTEGER", nullable: false), - Factor = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjCurrency", x => x.Id); - table.ForeignKey( - name: "FK_ObjCurrency_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjDock", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - NumBuildingPartAnimations = table.Column(type: "INTEGER", nullable: false), - NumBuildingVariationParts = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - BoatPositionX = table.Column(type: "INTEGER", nullable: false), - BoatPositionY = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjDock", x => x.Id); - table.ForeignKey( - name: "FK_ObjDock_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjHillShapes", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - HillHeightMapCount = table.Column(type: "INTEGER", nullable: false), - MountainHeightMapCount = table.Column(type: "INTEGER", nullable: false), - IsHeightMap = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjHillShapes", x => x.Id); - table.ForeignKey( - name: "FK_ObjHillShapes_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjIndustry", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - FarmImagesPerGrowthStage = table.Column(type: "INTEGER", nullable: false), - MinNumBuildings = table.Column(type: "INTEGER", nullable: false), - MaxNumBuildings = table.Column(type: "INTEGER", nullable: false), - Colours = table.Column(type: "INTEGER", nullable: false), - BuildingSizeFlags = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - TotalOfTypeInScenario = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - ScaffoldingSegmentType = table.Column(type: "INTEGER", nullable: false), - ScaffoldingColour = table.Column(type: "INTEGER", nullable: false), - MapColour = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - FarmTileNumImageAngles = table.Column(type: "INTEGER", nullable: false), - FarmGrowthStageWithNoProduction = table.Column(type: "INTEGER", nullable: false), - FarmIdealSize = table.Column(type: "INTEGER", nullable: false), - FarmNumStagesOfGrowth = table.Column(type: "INTEGER", nullable: false), - MonthlyClosureChance = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjIndustry", x => x.Id); - table.ForeignKey( - name: "FK_ObjIndustry_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjInterface", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - MapTooltipObjectColour = table.Column(type: "INTEGER", nullable: false), - MapTooltipCargoColour = table.Column(type: "INTEGER", nullable: false), - TooltipColour = table.Column(type: "INTEGER", nullable: false), - ErrorColour = table.Column(type: "INTEGER", nullable: false), - WindowPlayerColour = table.Column(type: "INTEGER", nullable: false), - WindowTitlebarColour = table.Column(type: "INTEGER", nullable: false), - WindowColour = table.Column(type: "INTEGER", nullable: false), - WindowConstructionColour = table.Column(type: "INTEGER", nullable: false), - WindowTerraFormColour = table.Column(type: "INTEGER", nullable: false), - WindowMapColour = table.Column(type: "INTEGER", nullable: false), - WindowOptionsColour = table.Column(type: "INTEGER", nullable: false), - Colour_11 = table.Column(type: "INTEGER", nullable: false), - TopToolbarPrimaryColour = table.Column(type: "INTEGER", nullable: false), - TopToolbarSecondaryColour = table.Column(type: "INTEGER", nullable: false), - TopToolbarTertiaryColour = table.Column(type: "INTEGER", nullable: false), - TopToolbarQuaternaryColour = table.Column(type: "INTEGER", nullable: false), - PlayerInfoToolbarColour = table.Column(type: "INTEGER", nullable: false), - TimeToolbarColour = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjInterface", x => x.Id); - table.ForeignKey( - name: "FK_ObjInterface_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjLand", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CostIndex = table.Column(type: "INTEGER", nullable: false), - NumGrowthStages = table.Column(type: "INTEGER", nullable: false), - NumImageAngles = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - CostFactor = table.Column(type: "INTEGER", nullable: false), - NumImagesPerGrowthStage = table.Column(type: "INTEGER", nullable: false), - DistributionPattern = table.Column(type: "INTEGER", nullable: false), - NumVariations = table.Column(type: "INTEGER", nullable: false), - VariationLikelihood = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjLand", x => x.Id); - table.ForeignKey( - name: "FK_ObjLand_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjLevelCrossing", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - AnimationSpeed = table.Column(type: "INTEGER", nullable: false), - ClosingFrames = table.Column(type: "INTEGER", nullable: false), - ClosedFrames = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjLevelCrossing", x => x.Id); - table.ForeignKey( - name: "FK_ObjLevelCrossing_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjRegion", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjRegion", x => x.Id); - table.ForeignKey( - name: "FK_ObjRegion_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjRoad", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoadPieces = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - TunnelCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - MaxSpeed = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - PaintStyle = table.Column(type: "INTEGER", nullable: false), - VehicleDisplayListVerticalOffset = table.Column(type: "INTEGER", nullable: false), - TargetTownSize = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjRoad", x => x.Id); - table.ForeignKey( - name: "FK_ObjRoad_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjRoadExtra", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoadPieces = table.Column(type: "INTEGER", nullable: false), - PaintStyle = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjRoadExtra", x => x.Id); - table.ForeignKey( - name: "FK_ObjRoadExtra_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjRoadStation", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - PaintStyle = table.Column(type: "INTEGER", nullable: false), - Height = table.Column(type: "INTEGER", nullable: false), - RoadPieces = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - CompatibleRoadObjectCount = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjRoadStation", x => x.Id); - table.ForeignKey( - name: "FK_ObjRoadStation_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjScaffolding", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjScaffolding", x => x.Id); - table.ForeignKey( - name: "FK_ObjScaffolding_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjScenarioText", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjScenarioText", x => x.Id); - table.ForeignKey( - name: "FK_ObjScenarioText_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjSnow", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjSnow", x => x.Id); - table.ForeignKey( - name: "FK_ObjSnow_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjSound", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ShouldLoop = table.Column(type: "INTEGER", nullable: false), - Volume = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjSound", x => x.Id); - table.ForeignKey( - name: "FK_ObjSound_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjSteam", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - NumStationaryTicks = table.Column(type: "INTEGER", nullable: false), - SpriteWidth = table.Column(type: "INTEGER", nullable: false), - SpriteHeightNegative = table.Column(type: "INTEGER", nullable: false), - SpriteHeightPositive = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjSteam", x => x.Id); - table.ForeignKey( - name: "FK_ObjSteam_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjStreetLight", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjStreetLight", x => x.Id); - table.ForeignKey( - name: "FK_ObjStreetLight_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjTownNames", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjTownNames", x => x.Id); - table.ForeignKey( - name: "FK_ObjTownNames_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjTrack", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - TrackPieces = table.Column(type: "INTEGER", nullable: false), - StationTrackPieces = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - TunnelCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - CurveSpeed = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - VehicleDisplayListVerticalOffset = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjTrack", x => x.Id); - table.ForeignKey( - name: "FK_ObjTrack_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjTrackExtra", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - TrackPieces = table.Column(type: "INTEGER", nullable: false), - PaintStyle = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjTrackExtra", x => x.Id); - table.ForeignKey( - name: "FK_ObjTrackExtra_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjTrackSignal", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Flags = table.Column(type: "INTEGER", nullable: false), - AnimationSpeed = table.Column(type: "INTEGER", nullable: false), - NumFrames = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjTrackSignal", x => x.Id); - table.ForeignKey( - name: "FK_ObjTrackSignal_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjTrackStation", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - PaintStyle = table.Column(type: "INTEGER", nullable: false), - Height = table.Column(type: "INTEGER", nullable: false), - TrackPieces = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - SellCostFactor = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjTrackStation", x => x.Id); - table.ForeignKey( - name: "FK_ObjTrackStation_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjTree", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - InitialHeight = table.Column(type: "INTEGER", nullable: false), - Height = table.Column(type: "INTEGER", nullable: false), - var_04 = table.Column(type: "INTEGER", nullable: false), - var_05 = table.Column(type: "INTEGER", nullable: false), - NumRotations = table.Column(type: "INTEGER", nullable: false), - NumGrowthStages = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - ShadowImageOffset = table.Column(type: "INTEGER", nullable: false), - SeasonState = table.Column(type: "INTEGER", nullable: false), - Season = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - BuildCostFactor = table.Column(type: "INTEGER", nullable: false), - ClearCostFactor = table.Column(type: "INTEGER", nullable: false), - Colours = table.Column(type: "INTEGER", nullable: false), - Rating = table.Column(type: "INTEGER", nullable: false), - DemolishRatingReduction = table.Column(type: "INTEGER", nullable: false), - SeasonalVariants = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjTree", x => x.Id); - table.ForeignKey( - name: "FK_ObjTree_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjTunnel", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjTunnel", x => x.Id); - table.ForeignKey( - name: "FK_ObjTunnel_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjVehicle", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Mode = table.Column(type: "INTEGER", nullable: false), - Type = table.Column(type: "INTEGER", nullable: false), - NumCarComponents = table.Column(type: "INTEGER", nullable: false), - TrackTypeId = table.Column(type: "INTEGER", nullable: false), - NumRequiredTrackExtras = table.Column(type: "INTEGER", nullable: false), - CostIndex = table.Column(type: "INTEGER", nullable: false), - CostFactor = table.Column(type: "INTEGER", nullable: false), - Reliability = table.Column(type: "INTEGER", nullable: false), - RunCostIndex = table.Column(type: "INTEGER", nullable: false), - RunCostFactor = table.Column(type: "INTEGER", nullable: false), - NumCompatibleVehicles = table.Column(type: "INTEGER", nullable: false), - Power = table.Column(type: "INTEGER", nullable: false), - Speed = table.Column(type: "INTEGER", nullable: false), - RackSpeed = table.Column(type: "INTEGER", nullable: false), - Weight = table.Column(type: "INTEGER", nullable: false), - Flags = table.Column(type: "INTEGER", nullable: false), - ShipWakeSpacing = table.Column(type: "INTEGER", nullable: false), - DesignedYear = table.Column(type: "INTEGER", nullable: false), - ObsoleteYear = table.Column(type: "INTEGER", nullable: false), - DrivingSoundType = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjVehicle", x => x.Id); - table.ForeignKey( - name: "FK_ObjVehicle_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjWall", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Height = table.Column(type: "INTEGER", nullable: false), - Flags1 = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjWall", x => x.Id); - table.ForeignKey( - name: "FK_ObjWall_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ObjWater", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CostIndex = table.Column(type: "INTEGER", nullable: false), - CostFactor = table.Column(type: "INTEGER", nullable: false), - ParentId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ObjWater", x => x.Id); - table.ForeignKey( - name: "FK_ObjWater_Objects_ParentId", - column: x => x.ParentId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "StringTable", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Language = table.Column(type: "INTEGER", nullable: false), - Text = table.Column(type: "TEXT", nullable: false), - ObjectId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_StringTable", x => x.Id); - table.ForeignKey( - name: "FK_StringTable_Objects_ObjectId", - column: x => x.ObjectId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblAuthorTblObject", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - ObjectsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblAuthorTblObject", x => new { x.AuthorsId, x.ObjectsId }); - table.ForeignKey( - name: "FK_TblAuthorTblObject_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblAuthorTblObject_Objects_ObjectsId", - column: x => x.ObjectsId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblObjectTblObjectPack", - columns: table => new - { - ObjectPacksId = table.Column(type: "INTEGER", nullable: false), - ObjectsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblObjectTblObjectPack", x => new { x.ObjectPacksId, x.ObjectsId }); - table.ForeignKey( - name: "FK_TblObjectTblObjectPack_ObjectPacks_ObjectPacksId", - column: x => x.ObjectPacksId, - principalTable: "ObjectPacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", - column: x => x.ObjectsId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblObjectTblTag", - columns: table => new - { - ObjectsId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblObjectTblTag", x => new { x.ObjectsId, x.TagsId }); - table.ForeignKey( - name: "FK_TblObjectTblTag_Objects_ObjectsId", - column: x => x.ObjectsId, - principalTable: "Objects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblObjectTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblAuthorTblSC5FilePack", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - SC5FilePacksId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblAuthorTblSC5FilePack", x => new { x.AuthorsId, x.SC5FilePacksId }); - table.ForeignKey( - name: "FK_TblAuthorTblSC5FilePack_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblAuthorTblSC5FilePack_SC5FilePacks_SC5FilePacksId", - column: x => x.SC5FilePacksId, - principalTable: "SC5FilePacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblSC5FilePackTblTag", - columns: table => new - { - SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblSC5FilePackTblTag", x => new { x.SC5FilePacksId, x.TagsId }); - table.ForeignKey( - name: "FK_TblSC5FilePackTblTag_SC5FilePacks_SC5FilePacksId", - column: x => x.SC5FilePacksId, - principalTable: "SC5FilePacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblSC5FilePackTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblAuthorTblSC5File", - columns: table => new - { - AuthorsId = table.Column(type: "INTEGER", nullable: false), - SC5FilesId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblAuthorTblSC5File", x => new { x.AuthorsId, x.SC5FilesId }); - table.ForeignKey( - name: "FK_TblAuthorTblSC5File_Authors_AuthorsId", - column: x => x.AuthorsId, - principalTable: "Authors", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblAuthorTblSC5File_SC5Files_SC5FilesId", - column: x => x.SC5FilesId, - principalTable: "SC5Files", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblSC5FileTblSC5FilePack", - columns: table => new - { - SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), - SC5FilesId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblSC5FileTblSC5FilePack", x => new { x.SC5FilePacksId, x.SC5FilesId }); - table.ForeignKey( - name: "FK_TblSC5FileTblSC5FilePack_SC5FilePacks_SC5FilePacksId", - column: x => x.SC5FilePacksId, - principalTable: "SC5FilePacks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblSC5FileTblSC5FilePack_SC5Files_SC5FilesId", - column: x => x.SC5FilesId, - principalTable: "SC5Files", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "TblSC5FileTblTag", - columns: table => new - { - SC5FilesId = table.Column(type: "INTEGER", nullable: false), - TagsId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TblSC5FileTblTag", x => new { x.SC5FilesId, x.TagsId }); - table.ForeignKey( - name: "FK_TblSC5FileTblTag_SC5Files_SC5FilesId", - column: x => x.SC5FilesId, - principalTable: "SC5Files", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TblSC5FileTblTag_Tags_TagsId", - column: x => x.TagsId, - principalTable: "Tags", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Authors_Name", - table: "Authors", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_DatObjects_DatName_DatChecksum", - table: "DatObjects", - columns: new[] { "DatName", "DatChecksum" }, - unique: true, - descending: new[] { true, false }); - - migrationBuilder.CreateIndex( - name: "IX_DatObjects_ObjectId", - table: "DatObjects", - column: "ObjectId"); - - migrationBuilder.CreateIndex( - name: "IX_DatObjects_xxHash3", - table: "DatObjects", - column: "xxHash3", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Licences_Name", - table: "Licences", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjAirport_Id", - table: "ObjAirport", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjAirport_ParentId", - table: "ObjAirport", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjBridge_Id", - table: "ObjBridge", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjBridge_ParentId", - table: "ObjBridge", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjBuilding_Id", - table: "ObjBuilding", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjBuilding_ParentId", - table: "ObjBuilding", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjCargo_Id", - table: "ObjCargo", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjCargo_ParentId", - table: "ObjCargo", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjCliffEdge_Id", - table: "ObjCliffEdge", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjCliffEdge_ParentId", - table: "ObjCliffEdge", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjClimate_Id", - table: "ObjClimate", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjClimate_ParentId", - table: "ObjClimate", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjCompetitor_Id", - table: "ObjCompetitor", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjCompetitor_ParentId", - table: "ObjCompetitor", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjCurrency_Id", - table: "ObjCurrency", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjCurrency_ParentId", - table: "ObjCurrency", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjDock_Id", - table: "ObjDock", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjDock_ParentId", - table: "ObjDock", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjectPacks_LicenceId", - table: "ObjectPacks", - column: "LicenceId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjectPacks_Name", - table: "ObjectPacks", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Objects_LicenceId", - table: "Objects", - column: "LicenceId"); - - migrationBuilder.CreateIndex( - name: "IX_Objects_Name", - table: "Objects", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjectsMissing_DatName_DatChecksum", - table: "ObjectsMissing", - columns: new[] { "DatName", "DatChecksum" }, - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjHillShapes_Id", - table: "ObjHillShapes", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjHillShapes_ParentId", - table: "ObjHillShapes", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjIndustry_Id", - table: "ObjIndustry", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjIndustry_ParentId", - table: "ObjIndustry", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjInterface_Id", - table: "ObjInterface", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjInterface_ParentId", - table: "ObjInterface", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjLand_Id", - table: "ObjLand", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjLand_ParentId", - table: "ObjLand", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjLevelCrossing_Id", - table: "ObjLevelCrossing", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjLevelCrossing_ParentId", - table: "ObjLevelCrossing", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjRegion_Id", - table: "ObjRegion", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjRegion_ParentId", - table: "ObjRegion", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjRoad_Id", - table: "ObjRoad", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjRoad_ParentId", - table: "ObjRoad", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjRoadExtra_Id", - table: "ObjRoadExtra", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjRoadExtra_ParentId", - table: "ObjRoadExtra", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjRoadStation_Id", - table: "ObjRoadStation", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjRoadStation_ParentId", - table: "ObjRoadStation", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjScaffolding_Id", - table: "ObjScaffolding", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjScaffolding_ParentId", - table: "ObjScaffolding", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjScenarioText_Id", - table: "ObjScenarioText", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjScenarioText_ParentId", - table: "ObjScenarioText", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjSnow_Id", - table: "ObjSnow", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjSnow_ParentId", - table: "ObjSnow", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjSound_Id", - table: "ObjSound", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjSound_ParentId", - table: "ObjSound", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjSteam_Id", - table: "ObjSteam", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjSteam_ParentId", - table: "ObjSteam", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjStreetLight_Id", - table: "ObjStreetLight", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjStreetLight_ParentId", - table: "ObjStreetLight", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjTownNames_Id", - table: "ObjTownNames", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjTownNames_ParentId", - table: "ObjTownNames", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrack_Id", - table: "ObjTrack", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrack_ParentId", - table: "ObjTrack", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrackExtra_Id", - table: "ObjTrackExtra", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrackExtra_ParentId", - table: "ObjTrackExtra", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrackSignal_Id", - table: "ObjTrackSignal", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrackSignal_ParentId", - table: "ObjTrackSignal", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrackStation_Id", - table: "ObjTrackStation", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjTrackStation_ParentId", - table: "ObjTrackStation", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjTree_Id", - table: "ObjTree", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjTree_ParentId", - table: "ObjTree", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjTunnel_Id", - table: "ObjTunnel", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjTunnel_ParentId", - table: "ObjTunnel", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjVehicle_Id", - table: "ObjVehicle", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjVehicle_ParentId", - table: "ObjVehicle", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjWall_Id", - table: "ObjWall", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjWall_ParentId", - table: "ObjWall", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_ObjWater_Id", - table: "ObjWater", - column: "Id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ObjWater_ParentId", - table: "ObjWater", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_SC5FilePacks_LicenceId", - table: "SC5FilePacks", - column: "LicenceId"); - - migrationBuilder.CreateIndex( - name: "IX_SC5FilePacks_Name", - table: "SC5FilePacks", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_SC5Files_LicenceId", - table: "SC5Files", - column: "LicenceId"); - - migrationBuilder.CreateIndex( - name: "IX_SC5Files_Name", - table: "SC5Files", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_StringTable_ObjectId", - table: "StringTable", - column: "ObjectId"); - - migrationBuilder.CreateIndex( - name: "IX_StringTable_Text", - table: "StringTable", - column: "Text"); - - migrationBuilder.CreateIndex( - name: "IX_Tags_Name", - table: "Tags", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblObject_ObjectsId", - table: "TblAuthorTblObject", - column: "ObjectsId"); - - migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblObjectPack_ObjectPacksId", - table: "TblAuthorTblObjectPack", - column: "ObjectPacksId"); - - migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblSC5File_SC5FilesId", - table: "TblAuthorTblSC5File", - column: "SC5FilesId"); - - migrationBuilder.CreateIndex( - name: "IX_TblAuthorTblSC5FilePack_SC5FilePacksId", - table: "TblAuthorTblSC5FilePack", - column: "SC5FilePacksId"); - - migrationBuilder.CreateIndex( - name: "IX_TblObjectPackTblTag_TagsId", - table: "TblObjectPackTblTag", - column: "TagsId"); - - migrationBuilder.CreateIndex( - name: "IX_TblObjectTblObjectPack_ObjectsId", - table: "TblObjectTblObjectPack", - column: "ObjectsId"); - - migrationBuilder.CreateIndex( - name: "IX_TblObjectTblTag_TagsId", - table: "TblObjectTblTag", - column: "TagsId"); + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Authors", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Authors", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Licences", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Text = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Licences", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ObjectsMissing", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DatName = table.Column(type: "TEXT", nullable: false), + DatChecksum = table.Column(type: "INTEGER", nullable: false), + ObjectType = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjectsMissing", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Tags", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tags", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ObjectPacks", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_ObjectPacks", x => x.Id); + table.ForeignKey( + name: "FK_ObjectPacks_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "Objects", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + SubObjectId = table.Column(type: "INTEGER", nullable: false), + ObjectType = table.Column(type: "INTEGER", nullable: false), + ObjectSource = table.Column(type: "INTEGER", nullable: false), + VehicleType = table.Column(type: "INTEGER", nullable: true), + Availability = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_Objects", x => x.Id); + table.ForeignKey( + name: "FK_Objects_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "SC5FilePacks", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_SC5FilePacks", x => x.Id); + table.ForeignKey( + name: "FK_SC5FilePacks_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "SC5Files", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ObjectSource = table.Column(type: "INTEGER", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Description = table.Column(type: "TEXT", nullable: true), + LicenceId = table.Column(type: "INTEGER", nullable: true), + CreatedDate = table.Column(type: "TEXT", nullable: true), + ModifiedDate = table.Column(type: "TEXT", nullable: true), + UploadedDate = table.Column(type: "TEXT", nullable: false, defaultValueSql: "date('now')") + }, + constraints: table => + { + table.PrimaryKey("PK_SC5Files", x => x.Id); + table.ForeignKey( + name: "FK_SC5Files_Licences_LicenceId", + column: x => x.LicenceId, + principalTable: "Licences", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblObjectPack", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + ObjectPacksId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblObjectPack", x => new { x.AuthorsId, x.ObjectPacksId }); + table.ForeignKey( + name: "FK_TblAuthorTblObjectPack_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblObjectPack_ObjectPacks_ObjectPacksId", + column: x => x.ObjectPacksId, + principalTable: "ObjectPacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblObjectPackTblTag", + columns: table => new + { + ObjectPacksId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblObjectPackTblTag", x => new { x.ObjectPacksId, x.TagsId }); + table.ForeignKey( + name: "FK_TblObjectPackTblTag_ObjectPacks_ObjectPacksId", + column: x => x.ObjectPacksId, + principalTable: "ObjectPacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblObjectPackTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DatObjects", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DatName = table.Column(type: "TEXT", nullable: false), + DatChecksum = table.Column(type: "INTEGER", nullable: false), + xxHash3 = table.Column(type: "INTEGER", nullable: false), + ObjectId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DatObjects", x => x.Id); + table.ForeignKey( + name: "FK_DatObjects_Objects_ObjectId", + column: x => x.ObjectId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjAirport", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + LargeTiles = table.Column(type: "INTEGER", nullable: false), + MinX = table.Column(type: "INTEGER", nullable: false), + MinY = table.Column(type: "INTEGER", nullable: false), + MaxX = table.Column(type: "INTEGER", nullable: false), + MaxY = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjAirport", x => x.Id); + table.ForeignKey( + name: "FK_ObjAirport_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjBridge", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Flags = table.Column(type: "INTEGER", nullable: false), + ClearHeight = table.Column(type: "INTEGER", nullable: false), + DeckDepth = table.Column(type: "INTEGER", nullable: false), + SpanLength = table.Column(type: "INTEGER", nullable: false), + PillarSpacing = table.Column(type: "INTEGER", nullable: false), + MaxSpeed = table.Column(type: "INTEGER", nullable: false), + MaxHeight = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BaseCostFactor = table.Column(type: "INTEGER", nullable: false), + HeightCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + DisabledTrackFlags = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjBridge", x => x.Id); + table.ForeignKey( + name: "FK_ObjBridge_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjBuilding", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + DemolishRatingReduction = table.Column(type: "INTEGER", nullable: false), + ScaffoldingSegmentType = table.Column(type: "INTEGER", nullable: false), + ScaffoldingColour = table.Column(type: "INTEGER", nullable: false), + Colours = table.Column(type: "INTEGER", nullable: false), + GeneratorFunction = table.Column(type: "INTEGER", nullable: false), + AverageNumberOnMap = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjBuilding", x => x.Id); + table.ForeignKey( + name: "FK_ObjBuilding_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCargo", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CargoTransferTime = table.Column(type: "INTEGER", nullable: false), + CargoCategory = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + NumPlatformVariations = table.Column(type: "INTEGER", nullable: false), + StationCargoDensity = table.Column(type: "INTEGER", nullable: false), + PremiumDays = table.Column(type: "INTEGER", nullable: false), + MaxNonPremiumDays = table.Column(type: "INTEGER", nullable: false), + NonPremiumRate = table.Column(type: "INTEGER", nullable: false), + PenaltyRate = table.Column(type: "INTEGER", nullable: false), + PaymentFactor = table.Column(type: "INTEGER", nullable: false), + PaymentIndex = table.Column(type: "INTEGER", nullable: false), + UnitSize = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCargo", x => x.Id); + table.ForeignKey( + name: "FK_ObjCargo_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCliffEdge", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCliffEdge", x => x.Id); + table.ForeignKey( + name: "FK_ObjCliffEdge_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjClimate", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + FirstSeason = table.Column(type: "INTEGER", nullable: false), + WinterSnowLine = table.Column(type: "INTEGER", nullable: false), + SummerSnowLine = table.Column(type: "INTEGER", nullable: false), + SeasonLength1 = table.Column(type: "INTEGER", nullable: false), + SeasonLength2 = table.Column(type: "INTEGER", nullable: false), + SeasonLength3 = table.Column(type: "INTEGER", nullable: false), + SeasonLength4 = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjClimate", x => x.Id); + table.ForeignKey( + name: "FK_ObjClimate_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCompetitor", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AvailableNamePrefixes = table.Column(type: "INTEGER", nullable: false), + AvailablePlaystyles = table.Column(type: "INTEGER", nullable: false), + Emotions = table.Column(type: "INTEGER", nullable: false), + Intelligence = table.Column(type: "INTEGER", nullable: false), + Aggressiveness = table.Column(type: "INTEGER", nullable: false), + Competitiveness = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCompetitor", x => x.Id); + table.ForeignKey( + name: "FK_ObjCompetitor_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjCurrency", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Separator = table.Column(type: "INTEGER", nullable: false), + Factor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjCurrency", x => x.Id); + table.ForeignKey( + name: "FK_ObjCurrency_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjDock", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + NumBuildingPartAnimations = table.Column(type: "INTEGER", nullable: false), + NumBuildingVariationParts = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + BoatPositionX = table.Column(type: "INTEGER", nullable: false), + BoatPositionY = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjDock", x => x.Id); + table.ForeignKey( + name: "FK_ObjDock_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjHillShapes", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + HillHeightMapCount = table.Column(type: "INTEGER", nullable: false), + MountainHeightMapCount = table.Column(type: "INTEGER", nullable: false), + IsHeightMap = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjHillShapes", x => x.Id); + table.ForeignKey( + name: "FK_ObjHillShapes_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjIndustry", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + FarmImagesPerGrowthStage = table.Column(type: "INTEGER", nullable: false), + MinNumBuildings = table.Column(type: "INTEGER", nullable: false), + MaxNumBuildings = table.Column(type: "INTEGER", nullable: false), + Colours = table.Column(type: "INTEGER", nullable: false), + BuildingSizeFlags = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + TotalOfTypeInScenario = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + ScaffoldingSegmentType = table.Column(type: "INTEGER", nullable: false), + ScaffoldingColour = table.Column(type: "INTEGER", nullable: false), + MapColour = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + FarmTileNumImageAngles = table.Column(type: "INTEGER", nullable: false), + FarmGrowthStageWithNoProduction = table.Column(type: "INTEGER", nullable: false), + FarmIdealSize = table.Column(type: "INTEGER", nullable: false), + FarmNumStagesOfGrowth = table.Column(type: "INTEGER", nullable: false), + MonthlyClosureChance = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjIndustry", x => x.Id); + table.ForeignKey( + name: "FK_ObjIndustry_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjInterface", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + MapTooltipObjectColour = table.Column(type: "INTEGER", nullable: false), + MapTooltipCargoColour = table.Column(type: "INTEGER", nullable: false), + TooltipColour = table.Column(type: "INTEGER", nullable: false), + ErrorColour = table.Column(type: "INTEGER", nullable: false), + WindowPlayerColour = table.Column(type: "INTEGER", nullable: false), + WindowTitlebarColour = table.Column(type: "INTEGER", nullable: false), + WindowColour = table.Column(type: "INTEGER", nullable: false), + WindowConstructionColour = table.Column(type: "INTEGER", nullable: false), + WindowTerraFormColour = table.Column(type: "INTEGER", nullable: false), + WindowMapColour = table.Column(type: "INTEGER", nullable: false), + WindowOptionsColour = table.Column(type: "INTEGER", nullable: false), + Colour_11 = table.Column(type: "INTEGER", nullable: false), + TopToolbarPrimaryColour = table.Column(type: "INTEGER", nullable: false), + TopToolbarSecondaryColour = table.Column(type: "INTEGER", nullable: false), + TopToolbarTertiaryColour = table.Column(type: "INTEGER", nullable: false), + TopToolbarQuaternaryColour = table.Column(type: "INTEGER", nullable: false), + PlayerInfoToolbarColour = table.Column(type: "INTEGER", nullable: false), + TimeToolbarColour = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjInterface", x => x.Id); + table.ForeignKey( + name: "FK_ObjInterface_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjLand", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CostIndex = table.Column(type: "INTEGER", nullable: false), + NumGrowthStages = table.Column(type: "INTEGER", nullable: false), + NumImageAngles = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + CostFactor = table.Column(type: "INTEGER", nullable: false), + NumImagesPerGrowthStage = table.Column(type: "INTEGER", nullable: false), + DistributionPattern = table.Column(type: "INTEGER", nullable: false), + NumVariations = table.Column(type: "INTEGER", nullable: false), + VariationLikelihood = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjLand", x => x.Id); + table.ForeignKey( + name: "FK_ObjLand_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjLevelCrossing", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + AnimationSpeed = table.Column(type: "INTEGER", nullable: false), + ClosingFrames = table.Column(type: "INTEGER", nullable: false), + ClosedFrames = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjLevelCrossing", x => x.Id); + table.ForeignKey( + name: "FK_ObjLevelCrossing_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRegion", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRegion", x => x.Id); + table.ForeignKey( + name: "FK_ObjRegion_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRoad", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoadPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + TunnelCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + MaxSpeed = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + VehicleDisplayListVerticalOffset = table.Column(type: "INTEGER", nullable: false), + TargetTownSize = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRoad", x => x.Id); + table.ForeignKey( + name: "FK_ObjRoad_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRoadExtra", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoadPieces = table.Column(type: "INTEGER", nullable: false), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRoadExtra", x => x.Id); + table.ForeignKey( + name: "FK_ObjRoadExtra_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjRoadStation", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + Height = table.Column(type: "INTEGER", nullable: false), + RoadPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + CompatibleRoadObjectCount = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjRoadStation", x => x.Id); + table.ForeignKey( + name: "FK_ObjRoadStation_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjScaffolding", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjScaffolding", x => x.Id); + table.ForeignKey( + name: "FK_ObjScaffolding_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjScenarioText", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjScenarioText", x => x.Id); + table.ForeignKey( + name: "FK_ObjScenarioText_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjSnow", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjSnow", x => x.Id); + table.ForeignKey( + name: "FK_ObjSnow_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjSound", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ShouldLoop = table.Column(type: "INTEGER", nullable: false), + Volume = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjSound", x => x.Id); + table.ForeignKey( + name: "FK_ObjSound_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjSteam", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + NumStationaryTicks = table.Column(type: "INTEGER", nullable: false), + SpriteWidth = table.Column(type: "INTEGER", nullable: false), + SpriteHeightNegative = table.Column(type: "INTEGER", nullable: false), + SpriteHeightPositive = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjSteam", x => x.Id); + table.ForeignKey( + name: "FK_ObjSteam_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjStreetLight", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjStreetLight", x => x.Id); + table.ForeignKey( + name: "FK_ObjStreetLight_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTownNames", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTownNames", x => x.Id); + table.ForeignKey( + name: "FK_ObjTownNames_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrack", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + TrackPieces = table.Column(type: "INTEGER", nullable: false), + StationTrackPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + TunnelCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + CurveSpeed = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + VehicleDisplayListVerticalOffset = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrack", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrack_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrackExtra", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + TrackPieces = table.Column(type: "INTEGER", nullable: false), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrackExtra", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrackExtra_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrackSignal", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Flags = table.Column(type: "INTEGER", nullable: false), + AnimationSpeed = table.Column(type: "INTEGER", nullable: false), + NumFrames = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrackSignal", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrackSignal_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTrackStation", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + PaintStyle = table.Column(type: "INTEGER", nullable: false), + Height = table.Column(type: "INTEGER", nullable: false), + TrackPieces = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + SellCostFactor = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTrackStation", x => x.Id); + table.ForeignKey( + name: "FK_ObjTrackStation_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTree", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + InitialHeight = table.Column(type: "INTEGER", nullable: false), + Height = table.Column(type: "INTEGER", nullable: false), + var_04 = table.Column(type: "INTEGER", nullable: false), + var_05 = table.Column(type: "INTEGER", nullable: false), + NumRotations = table.Column(type: "INTEGER", nullable: false), + NumGrowthStages = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + ShadowImageOffset = table.Column(type: "INTEGER", nullable: false), + SeasonState = table.Column(type: "INTEGER", nullable: false), + Season = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + BuildCostFactor = table.Column(type: "INTEGER", nullable: false), + ClearCostFactor = table.Column(type: "INTEGER", nullable: false), + Colours = table.Column(type: "INTEGER", nullable: false), + Rating = table.Column(type: "INTEGER", nullable: false), + DemolishRatingReduction = table.Column(type: "INTEGER", nullable: false), + SeasonalVariants = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTree", x => x.Id); + table.ForeignKey( + name: "FK_ObjTree_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjTunnel", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjTunnel", x => x.Id); + table.ForeignKey( + name: "FK_ObjTunnel_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjVehicle", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Mode = table.Column(type: "INTEGER", nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + NumCarComponents = table.Column(type: "INTEGER", nullable: false), + TrackTypeId = table.Column(type: "INTEGER", nullable: false), + NumRequiredTrackExtras = table.Column(type: "INTEGER", nullable: false), + CostIndex = table.Column(type: "INTEGER", nullable: false), + CostFactor = table.Column(type: "INTEGER", nullable: false), + Reliability = table.Column(type: "INTEGER", nullable: false), + RunCostIndex = table.Column(type: "INTEGER", nullable: false), + RunCostFactor = table.Column(type: "INTEGER", nullable: false), + NumCompatibleVehicles = table.Column(type: "INTEGER", nullable: false), + Power = table.Column(type: "INTEGER", nullable: false), + Speed = table.Column(type: "INTEGER", nullable: false), + RackSpeed = table.Column(type: "INTEGER", nullable: false), + Weight = table.Column(type: "INTEGER", nullable: false), + Flags = table.Column(type: "INTEGER", nullable: false), + ShipWakeSpacing = table.Column(type: "INTEGER", nullable: false), + DesignedYear = table.Column(type: "INTEGER", nullable: false), + ObsoleteYear = table.Column(type: "INTEGER", nullable: false), + DrivingSoundType = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjVehicle", x => x.Id); + table.ForeignKey( + name: "FK_ObjVehicle_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjWall", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Height = table.Column(type: "INTEGER", nullable: false), + Flags1 = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjWall", x => x.Id); + table.ForeignKey( + name: "FK_ObjWall_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ObjWater", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + CostIndex = table.Column(type: "INTEGER", nullable: false), + CostFactor = table.Column(type: "INTEGER", nullable: false), + ParentId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ObjWater", x => x.Id); + table.ForeignKey( + name: "FK_ObjWater_Objects_ParentId", + column: x => x.ParentId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StringTable", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + Language = table.Column(type: "INTEGER", nullable: false), + Text = table.Column(type: "TEXT", nullable: false), + ObjectId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StringTable", x => x.Id); + table.ForeignKey( + name: "FK_StringTable_Objects_ObjectId", + column: x => x.ObjectId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblObject", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + ObjectsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblObject", x => new { x.AuthorsId, x.ObjectsId }); + table.ForeignKey( + name: "FK_TblAuthorTblObject_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblObject_Objects_ObjectsId", + column: x => x.ObjectsId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblObjectTblObjectPack", + columns: table => new + { + ObjectPacksId = table.Column(type: "INTEGER", nullable: false), + ObjectsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblObjectTblObjectPack", x => new { x.ObjectPacksId, x.ObjectsId }); + table.ForeignKey( + name: "FK_TblObjectTblObjectPack_ObjectPacks_ObjectPacksId", + column: x => x.ObjectPacksId, + principalTable: "ObjectPacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblObjectTblObjectPack_Objects_ObjectsId", + column: x => x.ObjectsId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblObjectTblTag", + columns: table => new + { + ObjectsId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblObjectTblTag", x => new { x.ObjectsId, x.TagsId }); + table.ForeignKey( + name: "FK_TblObjectTblTag_Objects_ObjectsId", + column: x => x.ObjectsId, + principalTable: "Objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblObjectTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblSC5FilePack", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + SC5FilePacksId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblSC5FilePack", x => new { x.AuthorsId, x.SC5FilePacksId }); + table.ForeignKey( + name: "FK_TblAuthorTblSC5FilePack_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblSC5FilePack_SC5FilePacks_SC5FilePacksId", + column: x => x.SC5FilePacksId, + principalTable: "SC5FilePacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblSC5FilePackTblTag", + columns: table => new + { + SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblSC5FilePackTblTag", x => new { x.SC5FilePacksId, x.TagsId }); + table.ForeignKey( + name: "FK_TblSC5FilePackTblTag_SC5FilePacks_SC5FilePacksId", + column: x => x.SC5FilePacksId, + principalTable: "SC5FilePacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblSC5FilePackTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblAuthorTblSC5File", + columns: table => new + { + AuthorsId = table.Column(type: "INTEGER", nullable: false), + SC5FilesId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblAuthorTblSC5File", x => new { x.AuthorsId, x.SC5FilesId }); + table.ForeignKey( + name: "FK_TblAuthorTblSC5File_Authors_AuthorsId", + column: x => x.AuthorsId, + principalTable: "Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblAuthorTblSC5File_SC5Files_SC5FilesId", + column: x => x.SC5FilesId, + principalTable: "SC5Files", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblSC5FileTblSC5FilePack", + columns: table => new + { + SC5FilePacksId = table.Column(type: "INTEGER", nullable: false), + SC5FilesId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblSC5FileTblSC5FilePack", x => new { x.SC5FilePacksId, x.SC5FilesId }); + table.ForeignKey( + name: "FK_TblSC5FileTblSC5FilePack_SC5FilePacks_SC5FilePacksId", + column: x => x.SC5FilePacksId, + principalTable: "SC5FilePacks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblSC5FileTblSC5FilePack_SC5Files_SC5FilesId", + column: x => x.SC5FilesId, + principalTable: "SC5Files", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "TblSC5FileTblTag", + columns: table => new + { + SC5FilesId = table.Column(type: "INTEGER", nullable: false), + TagsId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TblSC5FileTblTag", x => new { x.SC5FilesId, x.TagsId }); + table.ForeignKey( + name: "FK_TblSC5FileTblTag_SC5Files_SC5FilesId", + column: x => x.SC5FilesId, + principalTable: "SC5Files", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TblSC5FileTblTag_Tags_TagsId", + column: x => x.TagsId, + principalTable: "Tags", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Authors_Name", + table: "Authors", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_DatObjects_DatName_DatChecksum", + table: "DatObjects", + columns: new[] { "DatName", "DatChecksum" }, + unique: true, + descending: new[] { true, false }); + + migrationBuilder.CreateIndex( + name: "IX_DatObjects_ObjectId", + table: "DatObjects", + column: "ObjectId"); + + migrationBuilder.CreateIndex( + name: "IX_DatObjects_xxHash3", + table: "DatObjects", + column: "xxHash3", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Licences_Name", + table: "Licences", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjAirport_Id", + table: "ObjAirport", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjAirport_ParentId", + table: "ObjAirport", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjBridge_Id", + table: "ObjBridge", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjBridge_ParentId", + table: "ObjBridge", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjBuilding_Id", + table: "ObjBuilding", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjBuilding_ParentId", + table: "ObjBuilding", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCargo_Id", + table: "ObjCargo", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCargo_ParentId", + table: "ObjCargo", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCliffEdge_Id", + table: "ObjCliffEdge", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCliffEdge_ParentId", + table: "ObjCliffEdge", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjClimate_Id", + table: "ObjClimate", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjClimate_ParentId", + table: "ObjClimate", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCompetitor_Id", + table: "ObjCompetitor", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCompetitor_ParentId", + table: "ObjCompetitor", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjCurrency_Id", + table: "ObjCurrency", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjCurrency_ParentId", + table: "ObjCurrency", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjDock_Id", + table: "ObjDock", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjDock_ParentId", + table: "ObjDock", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjectPacks_LicenceId", + table: "ObjectPacks", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjectPacks_Name", + table: "ObjectPacks", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Objects_LicenceId", + table: "Objects", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_Objects_Name", + table: "Objects", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjectsMissing_DatName_DatChecksum", + table: "ObjectsMissing", + columns: new[] { "DatName", "DatChecksum" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjHillShapes_Id", + table: "ObjHillShapes", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjHillShapes_ParentId", + table: "ObjHillShapes", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjIndustry_Id", + table: "ObjIndustry", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjIndustry_ParentId", + table: "ObjIndustry", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjInterface_Id", + table: "ObjInterface", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjInterface_ParentId", + table: "ObjInterface", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjLand_Id", + table: "ObjLand", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjLand_ParentId", + table: "ObjLand", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjLevelCrossing_Id", + table: "ObjLevelCrossing", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjLevelCrossing_ParentId", + table: "ObjLevelCrossing", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRegion_Id", + table: "ObjRegion", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRegion_ParentId", + table: "ObjRegion", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoad_Id", + table: "ObjRoad", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoad_ParentId", + table: "ObjRoad", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadExtra_Id", + table: "ObjRoadExtra", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadExtra_ParentId", + table: "ObjRoadExtra", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadStation_Id", + table: "ObjRoadStation", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjRoadStation_ParentId", + table: "ObjRoadStation", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjScaffolding_Id", + table: "ObjScaffolding", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjScaffolding_ParentId", + table: "ObjScaffolding", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjScenarioText_Id", + table: "ObjScenarioText", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjScenarioText_ParentId", + table: "ObjScenarioText", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjSnow_Id", + table: "ObjSnow", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjSnow_ParentId", + table: "ObjSnow", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjSound_Id", + table: "ObjSound", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjSound_ParentId", + table: "ObjSound", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjSteam_Id", + table: "ObjSteam", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjSteam_ParentId", + table: "ObjSteam", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjStreetLight_Id", + table: "ObjStreetLight", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjStreetLight_ParentId", + table: "ObjStreetLight", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTownNames_Id", + table: "ObjTownNames", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTownNames_ParentId", + table: "ObjTownNames", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrack_Id", + table: "ObjTrack", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrack_ParentId", + table: "ObjTrack", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackExtra_Id", + table: "ObjTrackExtra", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackExtra_ParentId", + table: "ObjTrackExtra", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackSignal_Id", + table: "ObjTrackSignal", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackSignal_ParentId", + table: "ObjTrackSignal", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackStation_Id", + table: "ObjTrackStation", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTrackStation_ParentId", + table: "ObjTrackStation", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTree_Id", + table: "ObjTree", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTree_ParentId", + table: "ObjTree", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjTunnel_Id", + table: "ObjTunnel", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjTunnel_ParentId", + table: "ObjTunnel", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjVehicle_Id", + table: "ObjVehicle", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjVehicle_ParentId", + table: "ObjVehicle", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjWall_Id", + table: "ObjWall", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjWall_ParentId", + table: "ObjWall", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_ObjWater_Id", + table: "ObjWater", + column: "Id", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ObjWater_ParentId", + table: "ObjWater", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_SC5FilePacks_LicenceId", + table: "SC5FilePacks", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_SC5FilePacks_Name", + table: "SC5FilePacks", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_SC5Files_LicenceId", + table: "SC5Files", + column: "LicenceId"); + + migrationBuilder.CreateIndex( + name: "IX_SC5Files_Name", + table: "SC5Files", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_StringTable_ObjectId", + table: "StringTable", + column: "ObjectId"); + + migrationBuilder.CreateIndex( + name: "IX_StringTable_Text", + table: "StringTable", + column: "Text"); + + migrationBuilder.CreateIndex( + name: "IX_Tags_Name", + table: "Tags", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblObject_ObjectsId", + table: "TblAuthorTblObject", + column: "ObjectsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblObjectPack_ObjectPacksId", + table: "TblAuthorTblObjectPack", + column: "ObjectPacksId"); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblSC5File_SC5FilesId", + table: "TblAuthorTblSC5File", + column: "SC5FilesId"); + + migrationBuilder.CreateIndex( + name: "IX_TblAuthorTblSC5FilePack_SC5FilePacksId", + table: "TblAuthorTblSC5FilePack", + column: "SC5FilePacksId"); + + migrationBuilder.CreateIndex( + name: "IX_TblObjectPackTblTag_TagsId", + table: "TblObjectPackTblTag", + column: "TagsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblObjectTblObjectPack_ObjectsId", + table: "TblObjectTblObjectPack", + column: "ObjectsId"); + + migrationBuilder.CreateIndex( + name: "IX_TblObjectTblTag_TagsId", + table: "TblObjectTblTag", + column: "TagsId"); - migrationBuilder.CreateIndex( - name: "IX_TblSC5FilePackTblTag_TagsId", - table: "TblSC5FilePackTblTag", - column: "TagsId"); + migrationBuilder.CreateIndex( + name: "IX_TblSC5FilePackTblTag_TagsId", + table: "TblSC5FilePackTblTag", + column: "TagsId"); - migrationBuilder.CreateIndex( - name: "IX_TblSC5FileTblSC5FilePack_SC5FilesId", - table: "TblSC5FileTblSC5FilePack", - column: "SC5FilesId"); + migrationBuilder.CreateIndex( + name: "IX_TblSC5FileTblSC5FilePack_SC5FilesId", + table: "TblSC5FileTblSC5FilePack", + column: "SC5FilesId"); - migrationBuilder.CreateIndex( - name: "IX_TblSC5FileTblTag_TagsId", - table: "TblSC5FileTblTag", - column: "TagsId"); - } + migrationBuilder.CreateIndex( + name: "IX_TblSC5FileTblTag_TagsId", + table: "TblSC5FileTblTag", + column: "TagsId"); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "DatObjects"); + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DatObjects"); - migrationBuilder.DropTable( - name: "ObjAirport"); + migrationBuilder.DropTable( + name: "ObjAirport"); - migrationBuilder.DropTable( - name: "ObjBridge"); + migrationBuilder.DropTable( + name: "ObjBridge"); - migrationBuilder.DropTable( - name: "ObjBuilding"); + migrationBuilder.DropTable( + name: "ObjBuilding"); - migrationBuilder.DropTable( - name: "ObjCargo"); + migrationBuilder.DropTable( + name: "ObjCargo"); - migrationBuilder.DropTable( - name: "ObjCliffEdge"); + migrationBuilder.DropTable( + name: "ObjCliffEdge"); - migrationBuilder.DropTable( - name: "ObjClimate"); + migrationBuilder.DropTable( + name: "ObjClimate"); - migrationBuilder.DropTable( - name: "ObjCompetitor"); + migrationBuilder.DropTable( + name: "ObjCompetitor"); - migrationBuilder.DropTable( - name: "ObjCurrency"); + migrationBuilder.DropTable( + name: "ObjCurrency"); - migrationBuilder.DropTable( - name: "ObjDock"); + migrationBuilder.DropTable( + name: "ObjDock"); - migrationBuilder.DropTable( - name: "ObjectsMissing"); + migrationBuilder.DropTable( + name: "ObjectsMissing"); - migrationBuilder.DropTable( - name: "ObjHillShapes"); + migrationBuilder.DropTable( + name: "ObjHillShapes"); - migrationBuilder.DropTable( - name: "ObjIndustry"); + migrationBuilder.DropTable( + name: "ObjIndustry"); - migrationBuilder.DropTable( - name: "ObjInterface"); + migrationBuilder.DropTable( + name: "ObjInterface"); - migrationBuilder.DropTable( - name: "ObjLand"); + migrationBuilder.DropTable( + name: "ObjLand"); - migrationBuilder.DropTable( - name: "ObjLevelCrossing"); + migrationBuilder.DropTable( + name: "ObjLevelCrossing"); - migrationBuilder.DropTable( - name: "ObjRegion"); + migrationBuilder.DropTable( + name: "ObjRegion"); - migrationBuilder.DropTable( - name: "ObjRoad"); + migrationBuilder.DropTable( + name: "ObjRoad"); - migrationBuilder.DropTable( - name: "ObjRoadExtra"); + migrationBuilder.DropTable( + name: "ObjRoadExtra"); - migrationBuilder.DropTable( - name: "ObjRoadStation"); + migrationBuilder.DropTable( + name: "ObjRoadStation"); - migrationBuilder.DropTable( - name: "ObjScaffolding"); + migrationBuilder.DropTable( + name: "ObjScaffolding"); - migrationBuilder.DropTable( - name: "ObjScenarioText"); + migrationBuilder.DropTable( + name: "ObjScenarioText"); - migrationBuilder.DropTable( - name: "ObjSnow"); + migrationBuilder.DropTable( + name: "ObjSnow"); - migrationBuilder.DropTable( - name: "ObjSound"); + migrationBuilder.DropTable( + name: "ObjSound"); - migrationBuilder.DropTable( - name: "ObjSteam"); + migrationBuilder.DropTable( + name: "ObjSteam"); - migrationBuilder.DropTable( - name: "ObjStreetLight"); + migrationBuilder.DropTable( + name: "ObjStreetLight"); - migrationBuilder.DropTable( - name: "ObjTownNames"); + migrationBuilder.DropTable( + name: "ObjTownNames"); - migrationBuilder.DropTable( - name: "ObjTrack"); + migrationBuilder.DropTable( + name: "ObjTrack"); - migrationBuilder.DropTable( - name: "ObjTrackExtra"); + migrationBuilder.DropTable( + name: "ObjTrackExtra"); - migrationBuilder.DropTable( - name: "ObjTrackSignal"); + migrationBuilder.DropTable( + name: "ObjTrackSignal"); - migrationBuilder.DropTable( - name: "ObjTrackStation"); + migrationBuilder.DropTable( + name: "ObjTrackStation"); - migrationBuilder.DropTable( - name: "ObjTree"); + migrationBuilder.DropTable( + name: "ObjTree"); - migrationBuilder.DropTable( - name: "ObjTunnel"); + migrationBuilder.DropTable( + name: "ObjTunnel"); - migrationBuilder.DropTable( - name: "ObjVehicle"); + migrationBuilder.DropTable( + name: "ObjVehicle"); - migrationBuilder.DropTable( - name: "ObjWall"); + migrationBuilder.DropTable( + name: "ObjWall"); - migrationBuilder.DropTable( - name: "ObjWater"); + migrationBuilder.DropTable( + name: "ObjWater"); - migrationBuilder.DropTable( - name: "StringTable"); + migrationBuilder.DropTable( + name: "StringTable"); - migrationBuilder.DropTable( - name: "TblAuthorTblObject"); + migrationBuilder.DropTable( + name: "TblAuthorTblObject"); - migrationBuilder.DropTable( - name: "TblAuthorTblObjectPack"); + migrationBuilder.DropTable( + name: "TblAuthorTblObjectPack"); - migrationBuilder.DropTable( - name: "TblAuthorTblSC5File"); + migrationBuilder.DropTable( + name: "TblAuthorTblSC5File"); - migrationBuilder.DropTable( - name: "TblAuthorTblSC5FilePack"); + migrationBuilder.DropTable( + name: "TblAuthorTblSC5FilePack"); - migrationBuilder.DropTable( - name: "TblObjectPackTblTag"); + migrationBuilder.DropTable( + name: "TblObjectPackTblTag"); - migrationBuilder.DropTable( - name: "TblObjectTblObjectPack"); + migrationBuilder.DropTable( + name: "TblObjectTblObjectPack"); - migrationBuilder.DropTable( - name: "TblObjectTblTag"); + migrationBuilder.DropTable( + name: "TblObjectTblTag"); - migrationBuilder.DropTable( - name: "TblSC5FilePackTblTag"); + migrationBuilder.DropTable( + name: "TblSC5FilePackTblTag"); - migrationBuilder.DropTable( - name: "TblSC5FileTblSC5FilePack"); + migrationBuilder.DropTable( + name: "TblSC5FileTblSC5FilePack"); - migrationBuilder.DropTable( - name: "TblSC5FileTblTag"); + migrationBuilder.DropTable( + name: "TblSC5FileTblTag"); - migrationBuilder.DropTable( - name: "Authors"); + migrationBuilder.DropTable( + name: "Authors"); - migrationBuilder.DropTable( - name: "ObjectPacks"); + migrationBuilder.DropTable( + name: "ObjectPacks"); - migrationBuilder.DropTable( - name: "Objects"); + migrationBuilder.DropTable( + name: "Objects"); - migrationBuilder.DropTable( - name: "SC5FilePacks"); + migrationBuilder.DropTable( + name: "SC5FilePacks"); - migrationBuilder.DropTable( - name: "SC5Files"); + migrationBuilder.DropTable( + name: "SC5Files"); - migrationBuilder.DropTable( - name: "Tags"); + migrationBuilder.DropTable( + name: "Tags"); - migrationBuilder.DropTable( - name: "Licences"); - } - } + migrationBuilder.DropTable( + name: "Licences"); + } + } } diff --git a/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs b/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs index d1d533d3..84353e4a 100644 --- a/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs +++ b/Definitions/Migrations/Loco/20260527120443_AddDatObjectFileName.cs @@ -1,28 +1,28 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Definitions.Migrations.Loco { - /// - public partial class AddDatObjectFileName : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "FileName", - table: "DatObjects", - type: "TEXT", - nullable: true); - } + /// + public partial class AddDatObjectFileName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "FileName", + table: "DatObjects", + type: "TEXT", + nullable: true); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "FileName", - table: "DatObjects"); - } - } + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "FileName", + table: "DatObjects"); + } + } } diff --git a/Gui/Models/ObjectEditorContext.cs b/Gui/Models/ObjectEditorContext.cs index 867fef7f..ea8f934c 100644 --- a/Gui/Models/ObjectEditorContext.cs +++ b/Gui/Models/ObjectEditorContext.cs @@ -1,18 +1,19 @@ -using Definitions; using Avalonia.Platform; using Avalonia.Threading; using Common; using Common.Logging; using Dat.Converters; using Dat.FileParsing; -using Dat.Services; using Dat.Types; +using Definitions; using Definitions.Database; using Definitions.DTO; using Definitions.ObjectModels; using Definitions.ObjectModels.Types; using DynamicData; +using Gui.Services; using Microsoft.Extensions.Logging; +using ObjectService.Services; using SixLabors.ImageSharp; using System; using System.Collections.Concurrent; @@ -24,7 +25,6 @@ using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; -using Gui.Services; namespace Gui.Models; @@ -202,7 +202,8 @@ void EnsureLocalServerDefaults() // Best-effort reindex of the user's configured obj-data folder(s) into the local DB. // Runs on the thread pool, swallows individual-folder errors so one bad path can't // stall the whole pass. - async Task ReindexConfiguredFoldersAsync() { + async Task ReindexConfiguredFoldersAsync() + { try { var folders = new List(); diff --git a/Gui/Services/CommonLoggerProvider.cs b/Gui/Services/CommonLoggerProvider.cs new file mode 100644 index 00000000..a9dfabb4 --- /dev/null +++ b/Gui/Services/CommonLoggerProvider.cs @@ -0,0 +1,58 @@ +using Microsoft.Extensions.Logging; +using System; + +namespace Gui.Services; + +// Bridges ASP.NET Core / Kestrel logging from the embedded ObjectService into the GUI's +// Common.Logging.Logger so its output shows up in the local-server log window. Without +// this provider the embedded host has no logging sinks at all (the standard console +// providers are cleared on purpose) so request/response activity disappears silently. +sealed class CommonLoggerProvider : ILoggerProvider +{ + readonly Common.Logging.Logger target; + + public CommonLoggerProvider(Common.Logging.Logger target) + { + this.target = target; + } + + public ILogger CreateLogger(string categoryName) => new CategoryLogger(target, categoryName); + + public void Dispose() + { + } + + sealed class CategoryLogger : ILogger + { + readonly Common.Logging.Logger target; + readonly string category; + + public CategoryLogger(Common.Logging.Logger target, string category) + { + this.target = target; + this.category = category; + } + + public IDisposable? BeginScope(TState state) where TState : notnull => null; + + public bool IsEnabled(LogLevel logLevel) => target.IsEnabled(logLevel); + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + { + if (!IsEnabled(logLevel)) + { + return; + } + + // Forward via the target Logger's standard Log path so it ends up in the queue + // + LogAdded event + observable collection bound to the LogWindow. The category + // name (e.g. "Microsoft.AspNetCore.Hosting.Diagnostics") is surfaced via EventId + // so the existing "[name]" formatting picks it up. + var forwardedEventId = string.IsNullOrEmpty(eventId.Name) + ? new EventId(eventId.Id, category) + : new EventId(eventId.Id, $"{category}/{eventId.Name}"); + + target.Log(logLevel, forwardedEventId, state, exception, formatter); + } + } +} diff --git a/Gui/Services/EmbeddedObjectServiceHost.cs b/Gui/Services/EmbeddedObjectServiceHost.cs index 11015d66..3568b76b 100644 --- a/Gui/Services/EmbeddedObjectServiceHost.cs +++ b/Gui/Services/EmbeddedObjectServiceHost.cs @@ -21,7 +21,7 @@ namespace Gui.Services; // ObjectServiceClient can target it via the resolved BaseAddress. public sealed class EmbeddedObjectServiceHost : ReactiveObject, IAsyncDisposable { - readonly ILogger logger; + readonly Common.Logging.Logger logger; readonly SemaphoreSlim lifecycleLock = new(1, 1); WebApplication? app; @@ -36,7 +36,7 @@ public sealed class EmbeddedObjectServiceHost : ReactiveObject, IAsyncDisposable public bool IsRunning => State == EmbeddedHostState.Running; - public EmbeddedObjectServiceHost(ILogger logger) + public EmbeddedObjectServiceHost(Common.Logging.Logger logger) { this.logger = logger; } @@ -68,8 +68,12 @@ public async Task StartAsync(ObjectServiceHostOptions options, CancellationToken var builder = WebApplication.CreateBuilder(); - // Suppress noisy console output from the embedded host - the GUI owns presentation. + // Replace the default console/debug providers with a single bridge into the + // GUI's LocalServerLogger so request/response activity from Kestrel + ASP.NET + // Core surfaces in the local-server log window. ClearProviders() alone would + // silence the embedded host entirely. builder.Logging.ClearProviders(); + _ = builder.Logging.AddProvider(new CommonLoggerProvider(logger)); ObjectServiceHost.ApplyOptionsToConfiguration(builder, options); ObjectServiceHost.ConfigureBuilder(builder); diff --git a/Gui/ViewModels/Loco/SCV5ViewModel.cs b/Gui/ViewModels/Loco/SCV5ViewModel.cs index f1b07ed8..e37ebe74 100644 --- a/Gui/ViewModels/Loco/SCV5ViewModel.cs +++ b/Gui/ViewModels/Loco/SCV5ViewModel.cs @@ -20,6 +20,7 @@ using System.Reactive; using System.Reactive.Linq; using System.Threading.Tasks; +using ObjectService.Services; namespace Gui.ViewModels; @@ -132,7 +133,7 @@ async Task DownloadMissingObjects(GameObjDataFolder targetFolder) return; } - var gameFolderScan = await Dat.Services.DatFolderScanner.ScanDirectoryAsync(folder, Logger).ConfigureAwait(true); + var gameFolderScan = await DatFolderScanner.ScanDirectoryAsync(folder, Logger).ConfigureAwait(true); var gameFolderIndex = new ObjectIndex(gameFolderScan.Succeeded.Select(r => new ObjectIndexEntry( r.DatName, r.RelativePath, null, r.DatChecksum, r.xxHash3, r.ObjectType, r.ObjectSource, r.CreatedDate, r.ModifiedDate, r.VehicleType))); diff --git a/Gui/ViewModels/RequiredObjectsListViewModel.cs b/Gui/ViewModels/RequiredObjectsListViewModel.cs index 2aaee439..a920234f 100644 --- a/Gui/ViewModels/RequiredObjectsListViewModel.cs +++ b/Gui/ViewModels/RequiredObjectsListViewModel.cs @@ -5,6 +5,7 @@ using DynamicData; using Gui.Models; using Gui.Views; +using ObjectService.Services; using ReactiveUI; using ReactiveUI.Fody.Helpers; using System; @@ -129,7 +130,7 @@ async Task PopulateFromFolderAsync() var dirPath = dir.Path.LocalPath; var logger = editorContext?.Logger ?? new Logger(); - var scan = await Dat.Services.DatFolderScanner.ScanDirectoryAsync(dirPath, logger); + var scan = await DatFolderScanner.ScanDirectoryAsync(dirPath, logger); var headers = scan.Succeeded .Select(entry => new ObjectModelHeader(entry.DatName, entry.ObjectType, entry.ObjectSource, entry.DatChecksum)); diff --git a/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs index 0a63fba4..549476f6 100644 --- a/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs @@ -1,8 +1,8 @@ -using Dat.Services; using Definitions.Database; using Definitions.DTO; using Definitions.Web; using Microsoft.AspNetCore.Mvc; +using ObjectService.Services; namespace ObjectService.RouteHandlers.TableHandlers; diff --git a/ObjectService/Services/DatFileScanResult.cs b/ObjectService/Services/DatFileScanResult.cs new file mode 100644 index 00000000..16ca77d0 --- /dev/null +++ b/ObjectService/Services/DatFileScanResult.cs @@ -0,0 +1,20 @@ +using Definitions.ObjectModels.Objects.Vehicle; +using Definitions.ObjectModels.Types; + +namespace ObjectService.Services; + +// Plain result for a single scanned .dat file. Mirrors the metadata the old +// ObjectIndexEntry stored, but lives in the Dat project so it can be produced +// without any database dependencies. The LocalObjectIndexService (in Definitions) +// is responsible for translating these into TblObject + TblDatObject rows. +public record DatFileScanResult( + string FullPath, + string RelativePath, + string DatName, + uint DatChecksum, + ulong xxHash3, + ObjectType ObjectType, + ObjectSource ObjectSource, + DateOnly CreatedDate, + DateOnly ModifiedDate, + VehicleType? VehicleType); diff --git a/ObjectService/Services/DatFolderScanResults.cs b/ObjectService/Services/DatFolderScanResults.cs new file mode 100644 index 00000000..a8a54693 --- /dev/null +++ b/ObjectService/Services/DatFolderScanResults.cs @@ -0,0 +1,5 @@ +namespace ObjectService.Services; + +public record DatFolderScanResults( + IReadOnlyList Succeeded, + IReadOnlyList Failed); diff --git a/Dat/Services/DatFolderScanner.cs b/ObjectService/Services/DatFolderScanner.cs similarity index 84% rename from Dat/Services/DatFolderScanner.cs rename to ObjectService/Services/DatFolderScanner.cs index e3668924..8e77069d 100644 --- a/Dat/Services/DatFolderScanner.cs +++ b/ObjectService/Services/DatFolderScanner.cs @@ -4,31 +4,10 @@ using Dat.Types; using Definitions.ObjectModels.Objects.Vehicle; using Definitions.ObjectModels.Types; -using Microsoft.Extensions.Logging; using System.Collections.Concurrent; using System.IO.Hashing; -namespace Dat.Services; - -// Plain result for a single scanned .dat file. Mirrors the metadata the old -// ObjectIndexEntry stored, but lives in the Dat project so it can be produced -// without any database dependencies. The LocalObjectIndexService (in Definitions) -// is responsible for translating these into TblObject + TblDatObject rows. -public record DatFileScanResult( - string FullPath, - string RelativePath, - string DatName, - uint DatChecksum, - ulong xxHash3, - ObjectType ObjectType, - ObjectSource ObjectSource, - DateOnly CreatedDate, - DateOnly ModifiedDate, - VehicleType? VehicleType); - -public record DatFolderScanResults( - IReadOnlyList Succeeded, - IReadOnlyList Failed); +namespace ObjectService.Services; public static class DatFolderScanner { diff --git a/Dat/Services/LocalObjectIndexService.cs b/ObjectService/Services/LocalObjectIndexService.cs similarity index 98% rename from Dat/Services/LocalObjectIndexService.cs rename to ObjectService/Services/LocalObjectIndexService.cs index 00477a74..ea17f050 100644 --- a/Dat/Services/LocalObjectIndexService.cs +++ b/ObjectService/Services/LocalObjectIndexService.cs @@ -1,9 +1,8 @@ using Definitions; using Definitions.Database; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -namespace Dat.Services; +namespace ObjectService.Services; // Database-backed local object index. Replaces the JSON-based ObjectIndex used by // the editor client. Each scanned .dat file becomes a TblObject (one per unique @@ -134,7 +133,7 @@ static async Task InsertScanResultsAsync(LocoDbContext db, IReadOnlyList Date: Fri, 5 Jun 2026 15:44:15 +1000 Subject: [PATCH 4/4] Refactor database context references and enhance object availability handling - Updated references from LocoDbContext to BaseLocoDbContext across multiple files to standardize database access. - Introduced ObjectAvailability handling in various object-related classes and services to ensure consistent availability status. - Modified ObjectIndex and ObjectIndexEntry to include Availability property. - Enhanced ObjectEditorContext to manage multiple ObjectIndexes based on file location. - Implemented tests to verify the correct behavior of object availability normalization in local host scenarios. - Refactored route handlers to conditionally map routes based on server mode. --- .../Services/DatabaseExportService.cs | 2 +- .../Services/DatabaseHelperScripts.cs | 36 +++--- .../Services/DatabaseImportService.cs | 2 +- DatabaseTools/ToolsSettings.cs | 2 +- Definitions/Database/IdentityContext.cs | 2 +- Definitions/ObjectIndex.cs | 8 +- Definitions/ObjectIndexEntry.cs | 3 +- Gui/EditorSettings.cs | 2 +- Gui/Models/FileSystemItems.cs | 2 + Gui/Models/ObjectEditorContext.cs | 106 ++++++++++++------ Gui/ViewModels/FolderTreeViewModel.cs | 22 ++-- Gui/ViewModels/Loco/SCV5ViewModel.cs | 19 ++-- .../RequiredObjectsListViewModel.cs | 3 +- ObjectService/Hosting/ObjectServiceHost.cs | 15 +++ .../TableHandlers/FolderRouteHandler.cs | 2 +- .../TableHandlers/ObjectRouteHandler.cs | 34 +++--- .../TableHandlers/V1RouteHandler.cs | 19 ++-- .../RouteHandlers/V1RouteBuilderExtensions.cs | 40 ------- .../RouteHandlers/V2RouteBuilderExtensions.cs | 44 ++++++++ ObjectService/ServerFolderManager.cs | 2 +- .../Services/LocalObjectIndexService.cs | 3 +- ObjectService/appsettings.json | 1 + .../ObjectServiceHostModeTests.cs | 73 ++++++++++++ .../Routes/ObjectMissingRoutesTest.cs | 17 +++ .../TestWebApplicationFactory.cs | 8 ++ 25 files changed, 321 insertions(+), 146 deletions(-) create mode 100644 ObjectService/RouteHandlers/V2RouteBuilderExtensions.cs create mode 100644 Tests/ObjectServiceIntegrationTests/ObjectServiceHostModeTests.cs diff --git a/DatabaseTools/Services/DatabaseExportService.cs b/DatabaseTools/Services/DatabaseExportService.cs index 39a45995..f9f37689 100644 --- a/DatabaseTools/Services/DatabaseExportService.cs +++ b/DatabaseTools/Services/DatabaseExportService.cs @@ -11,7 +11,7 @@ public static class DatabaseExportService public static Task ExportAllAsync(ToolsSettings settings, Action log) => Task.Run(() => { - using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) + using var db = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); log("Loading from database..."); diff --git a/DatabaseTools/Services/DatabaseHelperScripts.cs b/DatabaseTools/Services/DatabaseHelperScripts.cs index 9972d58b..a362648d 100644 --- a/DatabaseTools/Services/DatabaseHelperScripts.cs +++ b/DatabaseTools/Services/DatabaseHelperScripts.cs @@ -103,7 +103,7 @@ public static Task QueryBuildingVar_AC(ToolsSettings settings, Action lo { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, int var_ac)>(); @@ -144,7 +144,7 @@ public static Task QueryBuildingProducedQuantity(ToolsSettings settings, Action< { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, (string ProducedName, int ProducedQuantity))>(); @@ -181,7 +181,7 @@ public static Task QueryHeadquarters(ToolsSettings settings, Action log) { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource)>(); @@ -219,7 +219,7 @@ public static Task QueryCostIndex(ToolsSettings settings, Action log) => { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource, ObjectType ObjectType, byte CostIndex)>(); @@ -271,7 +271,7 @@ public static Task QueryTrackStationOneSidedTrack(ToolsSettings settings, Action { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, ObjectSource ObjectSource, List Flags)>(); @@ -328,7 +328,7 @@ public static Task QueryIndustryHasShadows(ToolsSettings settings, Action(); @@ -367,7 +367,7 @@ public static Task QueryVehicleBodyUnkSprites(ToolsSettings settings, Action(); @@ -406,7 +406,7 @@ public static Task QueryCargoCategories(ToolsSettings settings, Action l { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, CargoCategory CargoCategory, string LocalisedName, ObjectSource ObjectSource)>(); @@ -441,7 +441,7 @@ public static Task QueryCostIndices(ToolsSettings settings, Action log) { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var results = new List<(ObjectIndexEntry Obj, byte CostIndex, short? RunCostIndex)>(); @@ -497,11 +497,11 @@ public static Task QueryCostIndices(ToolsSettings settings, Action log) public static async Task WritexxHash3(ToolsSettings settings, Action log) { - using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) + using var db = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var objects = await db.DatObjects.Include(x => x.Object).ToListAsync(); @@ -528,11 +528,11 @@ public static async Task WritexxHash3(ToolsSettings settings, Action log public static async Task FixObjectDescriptions(ToolsSettings settings, Action log) { - using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) + using var db = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var objects = await db.Objects.Include(x => x.DatObjects).ToListAsync(); @@ -572,11 +572,11 @@ public static async Task FixObjectDescriptions(ToolsSettings settings, Action log) { - using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) + using var db = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); var objects = await db.Objects @@ -634,9 +634,9 @@ public static async Task SetupSubObjects(ToolsSettings settings, Action { var dir = settings.ObjectDirectory; var logger = new Logger(); - using var indexDb = LocoDbContext.GetDbFromFile(settings.DatabaseFile); + using var indexDb = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile); var index = ObjectIndex.FromDb(indexDb); - using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) + using var db = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); var objects = await db.Objects.Include(x => x.DatObjects).ToListAsync(); @@ -685,7 +685,7 @@ public static async Task SetupSubObjects(ToolsSettings settings, Action public static async Task QuerySubObjects(ToolsSettings settings, Action log) { - using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) + using var db = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); var results = await db.ObjClimate diff --git a/DatabaseTools/Services/DatabaseImportService.cs b/DatabaseTools/Services/DatabaseImportService.cs index 82d52dbb..49f56058 100644 --- a/DatabaseTools/Services/DatabaseImportService.cs +++ b/DatabaseTools/Services/DatabaseImportService.cs @@ -17,7 +17,7 @@ public static class DatabaseImportService public static Task SeedAllAsync(ToolsSettings settings, Action log) => Task.Run(() => { - using var db = LocoDbContext.GetDbFromFile(settings.DatabaseFile) + using var db = BaseLocoDbContext.GetDbFromFile(settings.DatabaseFile) ?? throw new InvalidOperationException($"Database not found at {settings.DatabaseFile}"); log($"Database: {settings.DatabaseFile}"); diff --git a/DatabaseTools/ToolsSettings.cs b/DatabaseTools/ToolsSettings.cs index 019cbbe1..d0e7eedb 100644 --- a/DatabaseTools/ToolsSettings.cs +++ b/DatabaseTools/ToolsSettings.cs @@ -8,7 +8,7 @@ namespace DatabaseTools; public class ToolsSettings : ReactiveObject { - [Reactive] public string DatabaseFile { get; set; } = LocoDbContext.DefaultDb; + [Reactive] public string DatabaseFile { get; set; } = BaseLocoDbContext.DefaultDb; [Reactive] public string ObjectDirectory { get; set; } = "Q:\\Games\\Locomotion\\Server\\Objects"; diff --git a/Definitions/Database/IdentityContext.cs b/Definitions/Database/IdentityContext.cs index d286653d..ac77d009 100644 --- a/Definitions/Database/IdentityContext.cs +++ b/Definitions/Database/IdentityContext.cs @@ -24,7 +24,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder builder) { // Default to the same SQLite file used by LocoDbContext for the design-time/CLI case _ = builder.UseSqlite( - $"Data Source={LocoDbContext.DefaultDb}", + $"Data Source={BaseLocoDbContext.DefaultDb}", sql => sql.MigrationsHistoryTable(MigrationsHistoryTableName)); } } diff --git a/Definitions/ObjectIndex.cs b/Definitions/ObjectIndex.cs index 448fdc17..92a879db 100644 --- a/Definitions/ObjectIndex.cs +++ b/Definitions/ObjectIndex.cs @@ -1,9 +1,12 @@ using System.Collections.ObjectModel; using Definitions.Database; +using Definitions.DTO; using Microsoft.EntityFrameworkCore; namespace Definitions; +public sealed record ObjectIndexKey(string Address, string Name, FileLocation FileLocation); + // Thin in-memory container of ObjectIndexEntry projections. The local client // builds this from the SQLite DB (LocalObjectIndexService) and the server builds // it from its own DB. Kept as a class so existing UI bindings on Objects remain valid. @@ -11,6 +14,8 @@ public class ObjectIndex { public ObservableCollection Objects { get; init; } = []; + public Dictionary OnlineCache { get; } = []; + public ObjectIndex() { } @@ -54,7 +59,8 @@ public static ObjectIndex FromDb(LocoDbContext db) d.Object.ObjectSource, d.Object.CreatedDate, d.Object.ModifiedDate, - d.Object.VehicleType)) + d.Object.VehicleType, + d.Object.Availability)) .ToList(); return new ObjectIndex(rows); } diff --git a/Definitions/ObjectIndexEntry.cs b/Definitions/ObjectIndexEntry.cs index 82796bd9..d3a80f88 100644 --- a/Definitions/ObjectIndexEntry.cs +++ b/Definitions/ObjectIndexEntry.cs @@ -16,7 +16,8 @@ public record ObjectIndexEntry( ObjectSource ObjectSource, DateOnly? CreatedDate, DateOnly? ModifiedDate, - VehicleType? VehicleType = null) + VehicleType? VehicleType = null, + ObjectAvailability Availability = ObjectAvailability.Available) { public string SimpleText => $"{DisplayName} | {FileName}"; } diff --git a/Gui/EditorSettings.cs b/Gui/EditorSettings.cs index 0ee5a5d6..80e230f7 100644 --- a/Gui/EditorSettings.cs +++ b/Gui/EditorSettings.cs @@ -56,7 +56,7 @@ public HashSet ObjDataDirectories public string DownloadFolder { get; set; } = string.Empty; public string CacheFolder { get; set; } = string.Empty; - public string DatabaseFile { get; set; } = LocoDbContext.DefaultDb; + public string DatabaseFile { get; set; } = BaseLocoDbContext.DefaultDb; public string LocomotionSteamObjDataFolder { get; set; } = string.Empty; public string LocomotionGoGObjDataFolder { get; set; } = string.Empty; diff --git a/Gui/Models/FileSystemItems.cs b/Gui/Models/FileSystemItems.cs index a3f790ea..2ead7c1c 100644 --- a/Gui/Models/FileSystemItems.cs +++ b/Gui/Models/FileSystemItems.cs @@ -1,5 +1,6 @@ using Definitions.ObjectModels.Objects.Vehicle; using Definitions.ObjectModels.Types; +using Definitions; using System; using System.Collections.ObjectModel; using System.Text.Json.Serialization; @@ -18,6 +19,7 @@ public record FileSystemItem( ObjectSource? ObjectSource = null, ObjectType? ObjectType = null, VehicleType? VehicleType = null, + ObjectAvailability? Availability = null, ObservableCollection? SubNodes = null) { public uint? DatChecksum { get; init; } diff --git a/Gui/Models/ObjectEditorContext.cs b/Gui/Models/ObjectEditorContext.cs index ea8f934c..51fc25d0 100644 --- a/Gui/Models/ObjectEditorContext.cs +++ b/Gui/Models/ObjectEditorContext.cs @@ -7,7 +7,6 @@ using Dat.Types; using Definitions; using Definitions.Database; -using Definitions.DTO; using Definitions.ObjectModels; using Definitions.ObjectModels.Types; using DynamicData; @@ -34,11 +33,7 @@ public class ObjectEditorContext : IDisposable, IAsyncDisposable public Logger Logger { get; init; } - public ObjectIndex ObjectIndex { get; set; } = new(); - - public ObjectIndex? ObjectIndexOnline { get; set; } - - public Dictionary OnlineCache { get; } = []; + public Dictionary ObjectIndexes { get; } = []; public PaletteMap PaletteMap { get; set; } = null!; @@ -153,6 +148,41 @@ public ObjectEditorContext() return Uri.TryCreate(address, UriKind.Absolute, out var uri) ? uri : null; } + public ObjectIndexKey GetObjectIndexKey(ObjectServiceClient client, FileLocation fileLocation, string? name = null) + { + var baseAddress = client.WebClient.BaseAddress; + var address = baseAddress?.ToString().TrimEnd('/') ?? string.Empty; + var serverName = name ?? (fileLocation == FileLocation.Local ? "Local" : baseAddress?.Host ?? "Online"); + return new ObjectIndexKey(address, serverName, fileLocation); + } + + public ObjectIndex GetOrAddObjectIndex(ObjectServiceClient client, FileLocation fileLocation, string? name = null) + { + var key = GetObjectIndexKey(client, fileLocation, name); + if (!ObjectIndexes.TryGetValue(key, out var index)) + { + index = new ObjectIndex(); + ObjectIndexes[key] = index; + } + + return index; + } + + public ObjectIndex? GetObjectIndex(ObjectServiceClient client, FileLocation fileLocation, string? name = null) + { + var key = GetObjectIndexKey(client, fileLocation, name); + return ObjectIndexes.TryGetValue(key, out var index) ? index : null; + } + + public ObjectIndex? GetObjectIndex(FileLocation fileLocation) + { + var client = fileLocation == FileLocation.Local ? ObjectServiceClient : RemoteObjectServiceClient; + return GetObjectIndex(client, fileLocation); + } + + public void SetObjectIndex(ObjectServiceClient client, FileLocation fileLocation, ObjectIndex index, string? name = null) + => ObjectIndexes[GetObjectIndexKey(client, fileLocation, name)] = index; + // Fills in sensible defaults for the embedded ObjectService when the user hasn't // configured paths yet. Lets the feature work out-of-the-box from a clean settings file: // the objects root lives under %APPDATA%/.../LocalServer and the palette is extracted @@ -480,21 +510,23 @@ bool TryLoadOnlineFile(FileSystemItem filesystemItem, out LocoUIObjectModel? loc return false; } - if (!OnlineCache.TryGetValue(filesystemItem.Id.Value, out var cachedLocoObjDto)) // issue - if an object doesn't download its full file, it's 'header' will remain in cache but unable to attempt redownload - { - // Pick the client by FileLocation: Local items came from the embedded server, - // Online items came from the remote master. The GUI treats them uniformly, - // but each must round-trip back to its originating server. - var client = filesystemItem.FileLocation == FileLocation.Online - ? RemoteObjectServiceClient - : ObjectServiceClient; + // Pick the client by FileLocation: Local items came from the embedded server, + // Online items came from the remote master. The GUI treats them uniformly, + // but each must round-trip back to its originating server. + var fileLocation = filesystemItem.FileLocation ?? FileLocation.Local; + var client = fileLocation == FileLocation.Online + ? RemoteObjectServiceClient + : ObjectServiceClient; - if (client == null) - { - Logger.LogError("Object service client is null"); - return false; - } + if (client == null) + { + Logger.LogError("Object service client is null"); + return false; + } + var objectIndex = GetOrAddObjectIndex(client, fileLocation); + if (!objectIndex.OnlineCache.TryGetValue(filesystemItem.Id.Value, out var cachedLocoObjDto)) // issue - if an object doesn't download its full file, it's 'header' will remain in cache but unable to attempt redownload + { Logger.LogDebug("Didn't find object {DisplayName} with unique id {Id} in cache - downloading it from {BaseAddress}", filesystemItem.DisplayName, filesystemItem.Id, client.WebClient.BaseAddress); // Synchronous bridge: TryLoadObject is a sync API used by many callers, so we must @@ -554,7 +586,7 @@ bool TryLoadOnlineFile(FileSystemItem filesystemItem, out LocoUIObjectModel? loc Logger.LogInformation("Downloaded object \"{DisplayName}\" with unique id {Id} and added it to the local cache", filesystemItem.DisplayName, filesystemItem.Id); Logger.LogDebug("{DisplayName} has authors=[{Value}], tags=[{Value2}], objectpacks=[{Value3}], licence={Licence} datobjects=[{Value4}]", filesystemItem.DisplayName, string.Join(", ", cachedLocoObjDto?.Authors?.Select(x => x.Name) ?? []), string.Join(", ", cachedLocoObjDto?.Tags?.Select(x => x.Name) ?? []), string.Join(", ", cachedLocoObjDto?.ObjectPacks?.Select(x => x.Name) ?? []), cachedLocoObjDto?.Licence, string.Join(",", cachedLocoObjDto?.DatObjects?.Select(x => x.DatName) ?? [])); - OnlineCache.Add(filesystemItem.Id.Value, cachedLocoObjDto!); + objectIndex.OnlineCache.Add(filesystemItem.Id.Value, cachedLocoObjDto!); } else { @@ -641,7 +673,7 @@ bool TryLoadLocalFile(FileSystemItem filesystemItem, out LocoUIObjectModel? loco { CreatedDate = filesystemItem.CreatedDate?.ToDateTimeOffset(), ModifiedDate = filesystemItem.ModifiedDate?.ToDateTimeOffset(), - Availability = Definitions.ObjectAvailability.Available, + Availability = ObjectAvailability.Available, //DatObjects = [new(0)], }; // todo: look up the rest of the data from internet @@ -693,17 +725,18 @@ async Task LoadObjDirectoryAsyncCore(string directory, IProgress progress Settings.Save(SettingsFile, Logger); var indexService = new LocalObjectIndexService( - () => LocoDbContext.GetDbFromFile(Settings.DatabaseFile) + () => BaseLocoDbContext.GetDbFromFile(Settings.DatabaseFile) ?? throw new FileNotFoundException($"Database file not found: {Settings.DatabaseFile}"), Logger); if (useExistingIndex) { - ObjectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); - Logger.LogInformation("Loaded index for {Directory} with {Count} objects from {Db}.", directory, ObjectIndex.Objects.Count, Settings.DatabaseFile); + var objectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); + SetObjectIndex(ObjectServiceClient, FileLocation.Local, objectIndex); + Logger.LogInformation("Loaded index for {Directory} with {Count} objects from {Db}.", directory, objectIndex.Objects.Count, Settings.DatabaseFile); // Reconcile against on-disk files; rescan deltas. - var indexed = ObjectIndex.Objects.Select(x => x.FileName).Where(x => !string.IsNullOrEmpty(x)).Cast().ToHashSet(); + var indexed = objectIndex.Objects.Select(x => x.FileName).Where(x => !string.IsNullOrEmpty(x)).Cast().ToHashSet(); var allFiles = SawyerStreamUtils.GetDatFilesInDirectory(directory).ToArray(); var added = allFiles.Except(indexed).ToList(); var removed = indexed.Except(allFiles).ToList(); @@ -713,30 +746,39 @@ async Task LoadObjDirectoryAsyncCore(string directory, IProgress progress Logger.LogWarning("Objects in index but not on disk: {Value}", string.Join(',', removed)); Logger.LogWarning("Objects on disk but not in index: {Value}", string.Join(',', added)); await indexService.RebuildFromFolderAsync(directory, progress).ConfigureAwait(false); - ObjectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); + objectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); + SetObjectIndex(ObjectServiceClient, FileLocation.Local, objectIndex); } } else { Logger.LogInformation("Rebuilding index for {Directory}", directory); await indexService.RebuildFromFolderAsync(directory, progress).ConfigureAwait(false); - ObjectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); - Logger.LogInformation("New index has {Count} objects.", ObjectIndex.Objects.Count); + var objectIndex = await indexService.BuildObjectIndexAsync().ConfigureAwait(false); + SetObjectIndex(ObjectServiceClient, FileLocation.Local, objectIndex); + Logger.LogInformation("New index has {Count} objects.", objectIndex.Objects.Count); } } public async Task CheckForDatFilesNotOnServer() { - if (ObjectIndex == null || ObjectIndexOnline == null || ObjectIndexOnline.Objects.Count == 0) + var localIndexes = ObjectIndexes.Where(x => x.Key.FileLocation == FileLocation.Local).Select(x => x.Value).ToList(); + var onlineIndexes = ObjectIndexes.Where(x => x.Key.FileLocation == FileLocation.Online && x.Value.Objects.Count > 0).ToList(); + if (localIndexes.Count == 0 || onlineIndexes.Count == 0) { return; } Logger.LogDebug("Comparing local objects to object repository"); - var localButNotOnline = ObjectIndex.Objects.ExceptBy(ObjectIndexOnline.Objects.Select( - x => (x.DisplayName, x.DatChecksum)), - x => (x.DisplayName, x.DatChecksum)).ToList(); + var onlineKeys = onlineIndexes + .SelectMany(x => x.Value.Objects) + .Select(x => (x.DisplayName, x.DatChecksum)) + .ToHashSet(); + var localButNotOnline = localIndexes + .SelectMany(x => x.Objects) + .ExceptBy(onlineKeys, x => (x.DisplayName, x.DatChecksum)) + .ToList(); if (localButNotOnline.Count != 0) { diff --git a/Gui/ViewModels/FolderTreeViewModel.cs b/Gui/ViewModels/FolderTreeViewModel.cs index 9f5a88b4..95148738 100644 --- a/Gui/ViewModels/FolderTreeViewModel.cs +++ b/Gui/ViewModels/FolderTreeViewModel.cs @@ -496,17 +496,10 @@ async Task> GetTreeItemsAsync(ObjectServiceClient? var selectedGroup = SelectedOnlineBrowseTarget.Group; - // Objects flow through the shared ObjectIndex cache on EditorContext. + // Objects flow through the per-server ObjectIndex cache on EditorContext. if (selectedGroup == OnlineApiEndpointGroup.Objects) { - Action setCachedIndex = fileLocation == FileLocation.Local - ? idx => EditorContext.ObjectIndex = idx - : idx => EditorContext.ObjectIndexOnline = idx; - Func getCachedIndex = fileLocation == FileLocation.Local - ? () => EditorContext.ObjectIndex - : () => EditorContext.ObjectIndexOnline; - - return await GetObjectDirectoryItemsAsync(client, fileLocation, setCachedIndex, getCachedIndex, useExistingIndex); + return await GetObjectDirectoryItemsAsync(client, fileLocation, useExistingIndex); } var cacheKey = (selectedGroup, fileLocation); @@ -567,8 +560,6 @@ async Task> GetBrowseResultsAsync(ObjectServiceClient? cli async Task> GetObjectDirectoryItemsAsync( ObjectServiceClient? client, FileLocation fileLocation, - Action setCachedIndex, - Func getCachedIndex, bool useExistingIndex) { if (client == null) @@ -576,7 +567,7 @@ async Task> GetObjectDirectoryItemsAsync( return []; } - var cached = getCachedIndex(); + var cached = EditorContext.GetObjectIndex(client, fileLocation); if (!useExistingIndex || cached == null) { var entries = (await client.GetListAsync(SelectedOnlineBrowseTarget.EndpointGroup)) @@ -590,9 +581,10 @@ async Task> GetObjectDirectoryItemsAsync( x.ObjectSource, x.CreatedDate, x.ModifiedDate, - x.VehicleType)); + x.VehicleType, + x.Availability)); cached = new ObjectIndex(entries); - setCachedIndex(cached); + EditorContext.SetObjectIndex(client, fileLocation, cached); } var baseDir = fileLocation == FileLocation.Online @@ -628,7 +620,7 @@ public static FileSystemItem IndexEntryToFileSystemItem(ObjectIndexEntry x, stri // fallback - DisplayName is never null computedFileName ??= x.DisplayName; - return new FileSystemItem(x.DisplayName, Path.Combine(baseDirectory, computedFileName), x.Id, x.CreatedDate, x.ModifiedDate, fileLocation, x.ObjectSource, x.ObjectType, x.VehicleType) + return new FileSystemItem(x.DisplayName, Path.Combine(baseDirectory, computedFileName), x.Id, x.CreatedDate, x.ModifiedDate, fileLocation, x.ObjectSource, x.ObjectType, x.VehicleType, x.Availability) { DatChecksum = x.DatChecksum, xxHash3 = x.xxHash3, diff --git a/Gui/ViewModels/Loco/SCV5ViewModel.cs b/Gui/ViewModels/Loco/SCV5ViewModel.cs index e37ebe74..43e2d196 100644 --- a/Gui/ViewModels/Loco/SCV5ViewModel.cs +++ b/Gui/ViewModels/Loco/SCV5ViewModel.cs @@ -127,9 +127,10 @@ async Task DownloadMissingObjects(GameObjDataFolder targetFolder) return; } - if (EditorContext.ObjectServiceClient == null) + var onlineClient = EditorContext.RemoteObjectServiceClient; + if (onlineClient == null) { - Logger.LogError("The object service client is null"); + Logger.LogError("The remote object service client is null"); return; } @@ -138,13 +139,15 @@ async Task DownloadMissingObjects(GameObjDataFolder targetFolder) r.DatName, r.RelativePath, null, r.DatChecksum, r.xxHash3, r.ObjectType, r.ObjectSource, r.CreatedDate, r.ModifiedDate, r.VehicleType))); - if (EditorContext.ObjectIndexOnline == null) + var onlineIndex = EditorContext.GetObjectIndex(onlineClient, FileLocation.Online); + if (onlineIndex == null) { // need to download the index, ie call /objects/list Logger.LogInformation("Online index doesn't exist - downloading now"); - EditorContext.ObjectIndexOnline = new ObjectIndex((await EditorContext.ObjectServiceClient.GetObjectListAsync()) - .Select(x => new ObjectIndexEntry(x.DisplayName, null, x.Id, x.DatChecksum, null, x.ObjectType, x.ObjectSource, x.CreatedDate, x.ModifiedDate, x.VehicleType))); + onlineIndex = new ObjectIndex((await onlineClient.GetObjectListAsync()) + .Select(x => new ObjectIndexEntry(x.DisplayName, null, x.Id, x.DatChecksum, null, x.ObjectType, x.ObjectSource, x.CreatedDate, x.ModifiedDate, x.VehicleType, x.Availability))); + EditorContext.SetObjectIndex(onlineClient, FileLocation.Online, onlineIndex); Logger.LogInformation("Index downloaded"); // technically should check if the index is downloaded and valid now @@ -165,7 +168,7 @@ async Task DownloadMissingObjects(GameObjDataFolder targetFolder) // obj is missing - we need to download Logger.LogInformation("Scenario {DisplayName} has missing object. Name=\"{Name}\" Checksum={DatChecksum} ObjectType={ObjectType} ", CurrentFile.DisplayName, obj.Name, obj.DatChecksum, obj.ObjectType); - var onlineObj = EditorContext.ObjectIndexOnline + var onlineObj = onlineIndex .Objects .FirstOrDefault(x => x.DisplayName == obj.Name && x.DatChecksum == obj.DatChecksum); // ideally would be SingleOrDefault but unfortunately DAT is not unique @@ -179,7 +182,7 @@ async Task DownloadMissingObjects(GameObjDataFolder targetFolder) obj.DatChecksum, obj.ObjectType); - var result = await EditorContext.ObjectServiceClient.AddMissingObjectAsync(missingEntry); + var result = await onlineClient.AddMissingObjectAsync(missingEntry); if (result != null) { Logger.LogInformation("Successfully added missing object to server: Id={Id} Name=\"{Name}\" Checksum=({DatChecksum})", result.Id, obj.Name, obj.DatChecksum); @@ -199,7 +202,7 @@ async Task DownloadMissingObjects(GameObjDataFolder targetFolder) } // download actual file - var downloadedObjBytes = await EditorContext.ObjectServiceClient.GetObjectFileAsync(onlineObj.Id.Value); + var downloadedObjBytes = await onlineClient.GetObjectFileAsync(onlineObj.Id.Value); if (downloadedObjBytes == null) { diff --git a/Gui/ViewModels/RequiredObjectsListViewModel.cs b/Gui/ViewModels/RequiredObjectsListViewModel.cs index a920234f..9d496249 100644 --- a/Gui/ViewModels/RequiredObjectsListViewModel.cs +++ b/Gui/ViewModels/RequiredObjectsListViewModel.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Common.Logging; +using Definitions; using Definitions.ObjectModels.Types; using DynamicData; using Gui.Models; @@ -90,7 +91,7 @@ public void Replace(IEnumerable headers) async Task AddItemAsync() { - var objectIndex = editorContext?.ObjectIndex; + var objectIndex = editorContext?.GetObjectIndex(FileLocation.Local); if (objectIndex == null) { return; diff --git a/ObjectService/Hosting/ObjectServiceHost.cs b/ObjectService/Hosting/ObjectServiceHost.cs index dae4a2e2..be878107 100644 --- a/ObjectService/Hosting/ObjectServiceHost.cs +++ b/ObjectService/Hosting/ObjectServiceHost.cs @@ -1,3 +1,4 @@ +using Definitions; using Definitions.Database; using Definitions.ObjectModels; using Microsoft.AspNetCore.Authentication.BearerToken; @@ -34,6 +35,7 @@ public static void ApplyOptionsToConfiguration(WebApplicationBuilder builder, Ob ["ObjectService:RootFolder"] = options.RootFolder, ["ObjectService:PaletteMapFile"] = options.PaletteMapFile, ["ObjectService:ShowScalar"] = options.ShowScalar ? "true" : "false", + ["ObjectService:IsServer"] = options.IsServer ? "true" : "false", ["JwtSettings:Key"] = options.JwtKey, ["JwtSettings:Issuer"] = options.JwtIssuer, ["JwtSettings:Audience"] = options.JwtAudience, @@ -102,6 +104,19 @@ public static async Task BootstrapAsync(ObjectServiceHostOptions options, Cancel .Options; await using var clientLocoDb = new ClientLocoDbContext(clientLocoOptions); _ = await clientLocoDb.Database.EnsureCreatedAsync(cancellationToken); + + var nonAvailableObjects = await clientLocoDb.Objects + .Where(x => x.Availability != ObjectAvailability.Available) + .ToListAsync(cancellationToken); + foreach (var obj in nonAvailableObjects) + { + obj.Availability = ObjectAvailability.Available; + } + + if (nonAvailableObjects.Count > 0) + { + _ = await clientLocoDb.SaveChangesAsync(cancellationToken); + } } } diff --git a/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs index 549476f6..f19562af 100644 --- a/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/FolderRouteHandler.cs @@ -37,7 +37,7 @@ public static async Task IndexFolderAsync( logger.LogInformation("[IndexFolder] Indexing folder \"{Path}\"", path); - LocoDbContext ContextFactory() => LocoDbContext.GetDbFromFile(sfm.DatabasePath) + LocoDbContext ContextFactory() => BaseLocoDbContext.GetDbFromFile(sfm.DatabasePath) ?? throw new FileNotFoundException($"Database file not found: {sfm.DatabasePath}"); // Scan the directory once so we can report scanned/failed counts. diff --git a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs index fbfcadd2..d038555c 100644 --- a/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs +++ b/ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs @@ -14,6 +14,7 @@ using Definitions.Web; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using SixLabors.ImageSharp; using System.IO.Compression; using System.IO.Hashing; @@ -34,13 +35,20 @@ public static void MapRoutes(IEndpointRouteBuilder parentRoute) public static void MapAdditionalRoutes(IEndpointRouteBuilder parentRoute) { - BaseTableRouteHandler.MapRoutes(parentRoute); + var configuration = parentRoute.ServiceProvider.GetRequiredService(); + if (IsServer(configuration)) + { + BaseTableRouteHandler.MapRoutes(parentRoute); + } var resourceRoute = parentRoute.MapGroup(RoutesV2.ResourceRoute); _ = resourceRoute.MapGet(RoutesV2.File, GetObjectFileAsync); _ = resourceRoute.MapGet(RoutesV2.Images, GetObjectImagesAsync); } + static bool IsServer(IConfiguration configuration) + => configuration.GetValue("ObjectService:IsServer") ?? true; + //static async Task CreateAsync(DtoObjectDescriptor request, [FromServices] LocoDbContext db, [FromServices] IServiceProvider sp, [FromServices] ILogger logger) //{ // logger.LogInformation("[CreateAsync] Upload requested"); @@ -182,9 +190,9 @@ public static void MapAdditionalRoutes(IEndpointRouteBuilder parentRoute) // return Results.Created($"Successfully added {tblObject.Name} with unique id {tblObject.Id}", tblObject.Id); //} - static async Task CreateDatAsync(DtoObjectPost request, [FromServices] LocoDbContext db, [FromServices] IServiceProvider sp, [FromServices] ILogger logger) + static async Task CreateDatAsync(DtoObjectPost request, [FromServices] LocoDbContext db, [FromServices] IServiceProvider sp, [FromServices] ILogger logger, [FromServices] IConfiguration configuration) { - Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(logger, "[CreateAsync] Upload requested"); + LoggerExtensions.LogInformation(logger, "[CreateAsync] Upload requested"); if (string.IsNullOrEmpty(request.DatBytesAsBase64)) { @@ -288,7 +296,7 @@ static async Task CreateDatAsync(DtoObjectPost request, [FromServices] ObjectSource = ObjectSource.Custom, // not possible to upload vanilla objects ObjectType = hdrs.S5.ObjectType.Convert(), VehicleType = vehicleType, - Availability = request.InitialAvailability, + Availability = IsServer(configuration) ? request.InitialAvailability : ObjectAvailability.Available, CreatedDate = request.CreatedDate, ModifiedDate = request.ModifiedDate, UploadedDate = DateOnly.UtcToday, @@ -339,7 +347,7 @@ static async Task CreateDatAsync(DtoObjectPost request, [FromServices] // update server index (in-memory projection; DB is source of truth) sfm.ObjectIndex.Objects.Add( - new ObjectIndexEntry(hdrs.S5.Name, saveFileName, tblObject.Id, hdrs.S5.Checksum, xxHash3, tblObject.ObjectType, tblObject.ObjectSource, tblObject.CreatedDate, tblObject.UploadedDate, tblObject.VehicleType)); + new ObjectIndexEntry(hdrs.S5.Name, saveFileName, tblObject.Id, hdrs.S5.Checksum, xxHash3, tblObject.ObjectType, tblObject.ObjectSource, tblObject.CreatedDate, tblObject.UploadedDate, tblObject.VehicleType, tblObject.Availability)); var response = new ExpandedTbl(tblObject, [], [], []).ToDtoDescriptor(); return Results.Created($"Successfully added {tblObject.Name} with unique id {tblObject.Id}", response); @@ -364,7 +372,7 @@ static async Task ReadAsync([FromRoute] UniqueObjectId id, [FromService return ReturnObject(descriptor, sfm, logger); } - static async Task UpdateAsync([FromRoute] UniqueObjectId id, DtoObjectPostResponse request, [FromServices] LocoDbContext db, [FromServices] ILogger logger, CancellationToken cancellationToken) + static async Task UpdateAsync([FromRoute] UniqueObjectId id, DtoObjectPostResponse request, [FromServices] LocoDbContext db, [FromServices] ILogger logger, [FromServices] IConfiguration configuration, CancellationToken cancellationToken) { logger.LogInformation("[UpdateAsync] Update requested for object {ObjectId}", id); @@ -387,7 +395,7 @@ static async Task UpdateAsync([FromRoute] UniqueObjectId id, DtoObjectP obj.Description = request.Description; obj.CreatedDate = request.CreatedDate; obj.ModifiedDate = request.ModifiedDate; - obj.Availability = request.Availability; + obj.Availability = IsServer(configuration) ? request.Availability : ObjectAvailability.Available; // Update licence navigation property if (request.Licence == null) @@ -487,7 +495,7 @@ static async Task DeleteAsync([FromRoute] UniqueObjectId id, [FromServi static async Task ListAsync(HttpContext context, [FromServices] LocoDbContext db, [FromServices] ILogger logger, CancellationToken cancellationToken) { - Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(logger, "[ListAsync] List requested for object"); + LoggerExtensions.LogInformation(logger, "[ListAsync] List requested for object"); if (context.Request.Query.Count == 0) { @@ -578,7 +586,7 @@ static async Task GetObjectImagesAsync([FromRoute] UniqueObjectId id, [ if (obj.ObjectSource is ObjectSource.LocomotionGoG or ObjectSource.LocomotionSteam) { - Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(logger, "Indexed object is a vanilla object."); + LoggerExtensions.LogWarning(logger, "Indexed object is a vanilla object."); return Results.Forbid(); } @@ -664,7 +672,7 @@ static async Task GetObjectFileAsync([FromRoute] UniqueObjectId id, [Fr static IResult ReturnObject(DtoObjectPostResponse? dtoDescriptor, ServerFolderManager sfm, ILogger logger) { - Microsoft.Extensions.Logging.LoggerExtensions.LogDebug(logger, "[ReturnObject]"); + LoggerExtensions.LogDebug(logger, "[ReturnObject]"); if (dtoDescriptor == null) { @@ -701,7 +709,7 @@ static IResult ReturnObject(DtoObjectPostResponse? dtoDescriptor, ServerFolderMa if (dtoDescriptor.ObjectSource is ObjectSource.LocomotionGoG or ObjectSource.LocomotionSteam) { - Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(logger, "User attempted to download a vanilla object"); + LoggerExtensions.LogWarning(logger, "User attempted to download a vanilla object"); dat.DatBytesAsBase64 = null; } else @@ -715,7 +723,7 @@ static IResult ReturnObject(DtoObjectPostResponse? dtoDescriptor, ServerFolderMa static IResult ReturnFile(TblObject? obj, ServerFolderManager sfm, ILogger logger) { - Microsoft.Extensions.Logging.LoggerExtensions.LogDebug(logger, "[ReturnFile]"); + LoggerExtensions.LogDebug(logger, "[ReturnFile]"); if (obj == null) { @@ -724,7 +732,7 @@ static IResult ReturnFile(TblObject? obj, ServerFolderManager sfm, ILogger ListObjects( LocoDbContext db, [FromServices] ILogger logger) { - Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(logger, "[ListObjects]"); + LoggerExtensions.LogInformation(logger, "[ListObjects]"); // Cap free-text query parameters to a reasonable length. Without this an // attacker can issue arbitrarily long `LIKE %…%` scans against SQLite. @@ -264,7 +265,7 @@ public static async Task GetObjectImages(UniqueObjectId uniqueObjectId, if (obj.ObjectSource is ObjectSource.LocomotionGoG or ObjectSource.LocomotionSteam) { - Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(logger, "Indexed object is a vanilla object."); + LoggerExtensions.LogWarning(logger, "Indexed object is a vanilla object."); return Results.Forbid(); } @@ -526,9 +527,9 @@ public static async Task GetSC5FilePack([FromQuery] int uniqueId, [From #region POST // eg: https://localhost:7230/v1/uploaddat/... - public static async Task UploadDat(DtoObjectPost request, [FromServices] LocoDbContext db, [FromServices] ILogger logger, [FromServices] IServiceProvider sp) + public static async Task UploadDat(DtoObjectPost request, [FromServices] LocoDbContext db, [FromServices] ILogger logger, [FromServices] IServiceProvider sp, [FromServices] IConfiguration configuration) { - Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(logger, "[UploadDat] Upload requested"); + LoggerExtensions.LogInformation(logger, "[UploadDat] Upload requested"); if (string.IsNullOrEmpty(request.DatBytesAsBase64)) { @@ -604,7 +605,7 @@ public static async Task UploadDat(DtoObjectPost request, [FromServices ObjectSource = ObjectSource.Custom, // not possible to upload vanilla objects ObjectType = hdrs.S5.ObjectType.Convert(), VehicleType = vehicleType, - Availability = request.InitialAvailability, + Availability = configuration.GetValue("ObjectService:IsServer") != false ? request.InitialAvailability : ObjectAvailability.Available, CreatedDate = createdDate, ModifiedDate = modifiedDate, UploadedDate = DateOnly.UtcToday, @@ -629,14 +630,14 @@ public static async Task UploadDat(DtoObjectPost request, [FromServices _ = await db.SaveChangesAsync(); sfm.ObjectIndex.Objects.Add( - new ObjectIndexEntry(hdrs.S5.Name, saveFileName, locoTbl.Id, hdrs.S5.Checksum, request.xxHash3, locoTbl.ObjectType, locoTbl.ObjectSource, createdDate, modifiedDate, locoTbl.VehicleType)); + new ObjectIndexEntry(hdrs.S5.Name, saveFileName, locoTbl.Id, hdrs.S5.Checksum, request.xxHash3, locoTbl.ObjectType, locoTbl.ObjectSource, createdDate, modifiedDate, locoTbl.VehicleType, locoTbl.Availability)); return Results.Created($"Successfully added {locoTbl.Name} with unique id {locoTbl.Id}", locoTbl.Id); } public static async Task UploadObject([FromServices] ILogger logger) { - Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(logger, "[UploadDat] - not implemented"); + LoggerExtensions.LogWarning(logger, "[UploadDat] - not implemented"); return await Task.Run(() => Results.Problem(statusCode: StatusCodes.Status501NotImplemented)); } @@ -646,13 +647,13 @@ public static async Task UploadObject([FromServices] ILogger UpdateDat([FromServices] ILogger logger) { - Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(logger, "[UploadDat] - not implemented"); + LoggerExtensions.LogWarning(logger, "[UploadDat] - not implemented"); return await Task.Run(() => Results.Problem(statusCode: StatusCodes.Status501NotImplemented)); } public static async Task UpdateObject([FromServices] ILogger logger) { - Microsoft.Extensions.Logging.LoggerExtensions.LogWarning(logger, "[UploadDat] - not implemented"); + LoggerExtensions.LogWarning(logger, "[UploadDat] - not implemented"); return await Task.Run(() => Results.Problem(statusCode: StatusCodes.Status501NotImplemented)); } diff --git a/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs b/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs index 9c37a42b..73269863 100644 --- a/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs +++ b/ObjectService/RouteHandlers/V1RouteBuilderExtensions.cs @@ -14,43 +14,3 @@ public static IEndpointConventionBuilder MapV1Routes(this IEndpointRouteBuilder return routeGroup; } } - -public static class V2RouteBuilderExtensions -{ - public static IEndpointConventionBuilder MapV2Routes(this IEndpointRouteBuilder endpoints) - { - var v2 = endpoints.MapGroup(RoutesV2.Prefix); - _ = v2.MapServerRoutes(); - _ = v2.MapAdminRoutes().RequireAuthorization(); - - return v2; - } - - static IEndpointConventionBuilder MapServerRoutes(this IEndpointRouteBuilder endpoints) - { - var routeGroup = endpoints.MapGroup(string.Empty); - ArgumentNullException.ThrowIfNull(routeGroup); - - AuthorRouteHandler.MapRoutes(routeGroup); - TagRouteHandler.MapRoutes(routeGroup); - LicenceRouteHandler.MapRoutes(routeGroup); - ObjectRouteHandler.MapRoutes(routeGroup); - ScenarioRouteHandler.MapRoutes(routeGroup); - SC5FilePackRouteHandler.MapRoutes(routeGroup); - ObjectPackRouteHandler.MapRoutes(routeGroup); - FolderRouteHandler.MapRoutes(routeGroup); - - return routeGroup; - } - - static IEndpointConventionBuilder MapAdminRoutes(this IEndpointRouteBuilder endpoints) - { - var routeGroup = endpoints.MapGroup(string.Empty); - ArgumentNullException.ThrowIfNull(routeGroup); - - UserRouteHandler.MapRoutes(routeGroup); - RoleRouteHandler.MapRoutes(routeGroup); - - return routeGroup; - } -} diff --git a/ObjectService/RouteHandlers/V2RouteBuilderExtensions.cs b/ObjectService/RouteHandlers/V2RouteBuilderExtensions.cs new file mode 100644 index 00000000..867c9564 --- /dev/null +++ b/ObjectService/RouteHandlers/V2RouteBuilderExtensions.cs @@ -0,0 +1,44 @@ +using Definitions.Web; +using ObjectService.RouteHandlers.TableHandlers; + +namespace ObjectService.RouteHandlers; + +public static class V2RouteBuilderExtensions +{ + public static IEndpointConventionBuilder MapV2Routes(this IEndpointRouteBuilder endpoints) + { + var v2 = endpoints.MapGroup(RoutesV2.Prefix); + _ = v2.MapServerRoutes(); + _ = v2.MapAdminRoutes().RequireAuthorization(); + + return v2; + } + + static IEndpointConventionBuilder MapServerRoutes(this IEndpointRouteBuilder endpoints) + { + var routeGroup = endpoints.MapGroup(string.Empty); + ArgumentNullException.ThrowIfNull(routeGroup); + + AuthorRouteHandler.MapRoutes(routeGroup); + TagRouteHandler.MapRoutes(routeGroup); + LicenceRouteHandler.MapRoutes(routeGroup); + ObjectRouteHandler.MapRoutes(routeGroup); + ScenarioRouteHandler.MapRoutes(routeGroup); + SC5FilePackRouteHandler.MapRoutes(routeGroup); + ObjectPackRouteHandler.MapRoutes(routeGroup); + FolderRouteHandler.MapRoutes(routeGroup); + + return routeGroup; + } + + static IEndpointConventionBuilder MapAdminRoutes(this IEndpointRouteBuilder endpoints) + { + var routeGroup = endpoints.MapGroup(string.Empty); + ArgumentNullException.ThrowIfNull(routeGroup); + + UserRouteHandler.MapRoutes(routeGroup); + RoleRouteHandler.MapRoutes(routeGroup); + + return routeGroup; + } +} diff --git a/ObjectService/ServerFolderManager.cs b/ObjectService/ServerFolderManager.cs index 6a2ae2f7..b8ea76df 100644 --- a/ObjectService/ServerFolderManager.cs +++ b/ObjectService/ServerFolderManager.cs @@ -58,7 +58,7 @@ public ServerFolderManager(string rootDirectory, string databasePath) try { - using var db = LocoDbContext.GetDbFromFile(databasePath) + using var db = BaseLocoDbContext.GetDbFromFile(databasePath) ?? throw new FileNotFoundException($"Database file not found: {databasePath}"); ObjectIndex = ObjectIndex.FromDb(db); } diff --git a/ObjectService/Services/LocalObjectIndexService.cs b/ObjectService/Services/LocalObjectIndexService.cs index ea17f050..228cf113 100644 --- a/ObjectService/Services/LocalObjectIndexService.cs +++ b/ObjectService/Services/LocalObjectIndexService.cs @@ -86,7 +86,8 @@ public async Task BuildObjectIndexAsync(CancellationToken cancellat d.Object.ObjectSource, d.Object.CreatedDate, d.Object.ModifiedDate, - d.Object.VehicleType)) + d.Object.VehicleType, + ObjectAvailability.Available)) .ToListAsync(cancellationToken); return new ObjectIndex(rows); } diff --git a/ObjectService/appsettings.json b/ObjectService/appsettings.json index 24223157..e3109a36 100644 --- a/ObjectService/appsettings.json +++ b/ObjectService/appsettings.json @@ -25,6 +25,7 @@ "ObjectService": { "RootFolder": "Q:\\Games\\Locomotion\\Server", "PaletteMapFile": "Q:\\Games\\Locomotion\\Palettes\\palette.png", + "IsServer": true, "ShowScalar": true, "RateLimiter": { "ReplenishmentPeriod": 1, diff --git a/Tests/ObjectServiceIntegrationTests/ObjectServiceHostModeTests.cs b/Tests/ObjectServiceIntegrationTests/ObjectServiceHostModeTests.cs new file mode 100644 index 00000000..ee2f5612 --- /dev/null +++ b/Tests/ObjectServiceIntegrationTests/ObjectServiceHostModeTests.cs @@ -0,0 +1,73 @@ +using Definitions; +using Definitions.Database; +using Definitions.ObjectModels.Types; +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using NUnit.Framework; +using ObjectService.Hosting; + +namespace ObjectService.Tests.Integration; + +[TestFixture] +public class ObjectServiceHostModeTests +{ + [Test] + public async Task BootstrapAsync_LocalHost_NormalisesObjectAvailability() + { + var testDirectory = Directory.CreateTempSubdirectory("ObjectServiceLocalHost"); + try + { + var databaseFile = Path.Combine(testDirectory.FullName, "local.db"); + var connectionString = $"Data Source={databaseFile}"; + var dbOptions = new DbContextOptionsBuilder() + .UseSqlite(connectionString) + .Options; + + await using (var db = new ClientLocoDbContext(dbOptions)) + { + _ = await db.Database.EnsureCreatedAsync(); + var obj = new TblObject + { + Name = "local-unavailable-object", + ObjectType = ObjectType.Vehicle, + ObjectSource = ObjectSource.Custom, + Availability = ObjectAvailability.Unavailable, + SubObjectId = 0, + }; + + obj.DatObjects.Add(new TblDatObject + { + DatName = "LOCALOBJ", + DatChecksum = 123, + xxHash3 = 456, + ObjectId = 0, + Object = obj, + }); + + _ = db.Objects.Add(obj); + _ = await db.SaveChangesAsync(); + } + + await ObjectServiceHost.BootstrapAsync(new ObjectServiceHostOptions + { + RootFolder = Path.Combine(testDirectory.FullName, "server-root"), + DatabaseFile = databaseFile, + PaletteMapFile = Path.Combine(testDirectory.FullName, "palette.png"), + JwtKey = "0123456789abcdef0123456789abcdef", + IsServer = false, + }); + + await using var verifiedDb = new ClientLocoDbContext(dbOptions); + var availability = await verifiedDb.Objects + .Select(x => x.Availability) + .SingleAsync(); + + Assert.That(availability, Is.EqualTo(ObjectAvailability.Available)); + } + finally + { + SqliteConnection.ClearAllPools(); + testDirectory.Delete(recursive: true); + } + } +} diff --git a/Tests/ObjectServiceIntegrationTests/Routes/ObjectMissingRoutesTest.cs b/Tests/ObjectServiceIntegrationTests/Routes/ObjectMissingRoutesTest.cs index 07a34832..de2b9eca 100644 --- a/Tests/ObjectServiceIntegrationTests/Routes/ObjectMissingRoutesTest.cs +++ b/Tests/ObjectServiceIntegrationTests/Routes/ObjectMissingRoutesTest.cs @@ -3,7 +3,9 @@ using Definitions.DTO.Mappers; using Definitions.ObjectModels.Types; using Definitions.Web; +using Microsoft.AspNetCore.Routing; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; using NUnit.Framework; using ObjectService.Tests.Integration; @@ -48,4 +50,19 @@ protected override DtoObjectMissingEntry PutRequestDto protected override DtoObjectMissingEntry PutResponseDto => new(1, "TESTOBJ2", 123456788, ObjectType.StreetLight); + + [Test] + public async Task MissingObjectsRoute_IsNotMapped_WhenHostIsLocal() + { + using var localFactory = new TestWebApplicationFactory(isServer: false); + _ = localFactory.CreateClient(); + + var endpoints = localFactory.Services.GetRequiredService().Endpoints; + var routePatterns = endpoints + .OfType() + .Select(x => x.RoutePattern.RawText); + + Assert.That(routePatterns, Does.Not.Contain(RoutesV2.Prefix + RoutesV2.Objects + RoutesV2.Missing)); + await Task.CompletedTask; + } } diff --git a/Tests/ObjectServiceIntegrationTests/TestWebApplicationFactory.cs b/Tests/ObjectServiceIntegrationTests/TestWebApplicationFactory.cs index 30ff0129..54d2d211 100644 --- a/Tests/ObjectServiceIntegrationTests/TestWebApplicationFactory.cs +++ b/Tests/ObjectServiceIntegrationTests/TestWebApplicationFactory.cs @@ -12,6 +12,13 @@ namespace ObjectService.Tests.Integration; public class TestWebApplicationFactory : WebApplicationFactory where TProgram : class { + readonly bool isServer; + + public TestWebApplicationFactory(bool isServer = true) + { + this.isServer = isServer; + } + static DirectoryInfo? MakeServerFolderManagerTestDirectories() { // parent dir @@ -66,6 +73,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) [ new("ObjectService:RootFolder", testFolder.FullName), new("ObjectService:PaletteMapFile", dummyPaletteFile), + new("ObjectService:IsServer", isServer ? "True" : "False"), new("ObjectService:ShowScalar", "False"), ]) .Build();