Отказ от отдельной легаси-сущности
This commit is contained in:
+14
-18
@@ -38,7 +38,7 @@ partial class EntityViewForm
|
|||||||
DescriptionTextBox = new TextBox();
|
DescriptionTextBox = new TextBox();
|
||||||
DatabaseViewer = new DatabaseViewerControl();
|
DatabaseViewer = new DatabaseViewerControl();
|
||||||
EntityTreeViewerControl = new EntityTreeViewerControl();
|
EntityTreeViewerControl = new EntityTreeViewerControl();
|
||||||
MainMenuStrip = new MenuStrip();
|
MenuStrip = new MenuStrip();
|
||||||
FileToolStripMenuItem = new ToolStripMenuItem();
|
FileToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ExitToolStripMenuItem = new ToolStripMenuItem();
|
ExitToolStripMenuItem = new ToolStripMenuItem();
|
||||||
WindowsToolStripMenuItem = new ToolStripMenuItem();
|
WindowsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
@@ -54,7 +54,7 @@ partial class EntityViewForm
|
|||||||
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).BeginInit();
|
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).BeginInit();
|
||||||
ResultSplitContainer.Panel2.SuspendLayout();
|
ResultSplitContainer.Panel2.SuspendLayout();
|
||||||
ResultSplitContainer.SuspendLayout();
|
ResultSplitContainer.SuspendLayout();
|
||||||
MainMenuStrip.SuspendLayout();
|
MenuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// RootSplitContainer
|
// RootSplitContainer
|
||||||
@@ -110,10 +110,6 @@ partial class EntityViewForm
|
|||||||
ResultSplitContainer.Location = new Point(0, 0);
|
ResultSplitContainer.Location = new Point(0, 0);
|
||||||
ResultSplitContainer.Name = "ResultSplitContainer";
|
ResultSplitContainer.Name = "ResultSplitContainer";
|
||||||
//
|
//
|
||||||
// ResultSplitContainer.Panel1
|
|
||||||
//
|
|
||||||
ResultSplitContainer.Panel1.Controls.Add(EntityTreeViewerControl);
|
|
||||||
//
|
|
||||||
// ResultSplitContainer.Panel2
|
// ResultSplitContainer.Panel2
|
||||||
//
|
//
|
||||||
ResultSplitContainer.Panel2.Controls.Add(DescriptionTextBox);
|
ResultSplitContainer.Panel2.Controls.Add(DescriptionTextBox);
|
||||||
@@ -156,14 +152,14 @@ partial class EntityViewForm
|
|||||||
EntityTreeViewerControl.TabIndex = 0;
|
EntityTreeViewerControl.TabIndex = 0;
|
||||||
EntityTreeViewerControl.TypeFontSize = 7F;
|
EntityTreeViewerControl.TypeFontSize = 7F;
|
||||||
//
|
//
|
||||||
// MainMenuStrip
|
// MenuStrip
|
||||||
//
|
//
|
||||||
MainMenuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem, WindowsToolStripMenuItem });
|
MenuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem, WindowsToolStripMenuItem });
|
||||||
MainMenuStrip.Location = new Point(0, 0);
|
MenuStrip.Location = new Point(0, 0);
|
||||||
MainMenuStrip.Name = "MainMenuStrip";
|
MenuStrip.Name = "MainMenuStrip";
|
||||||
MainMenuStrip.Size = new Size(1384, 24);
|
MenuStrip.Size = new Size(1384, 24);
|
||||||
MainMenuStrip.TabIndex = 1;
|
MenuStrip.TabIndex = 1;
|
||||||
MainMenuStrip.Text = "menuStrip1";
|
MenuStrip.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// FileToolStripMenuItem
|
// FileToolStripMenuItem
|
||||||
//
|
//
|
||||||
@@ -175,7 +171,7 @@ partial class EntityViewForm
|
|||||||
// ExitToolStripMenuItem
|
// ExitToolStripMenuItem
|
||||||
//
|
//
|
||||||
ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";
|
ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";
|
||||||
ExitToolStripMenuItem.Size = new Size(180, 22);
|
ExitToolStripMenuItem.Size = new Size(109, 22);
|
||||||
ExitToolStripMenuItem.Text = "Выход";
|
ExitToolStripMenuItem.Text = "Выход";
|
||||||
ExitToolStripMenuItem.Click += ExitToolStripMenuItem_Click;
|
ExitToolStripMenuItem.Click += ExitToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
@@ -206,7 +202,7 @@ partial class EntityViewForm
|
|||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1384, 861);
|
ClientSize = new Size(1384, 861);
|
||||||
Controls.Add(RootSplitContainer);
|
Controls.Add(RootSplitContainer);
|
||||||
Controls.Add(MainMenuStrip);
|
Controls.Add(MenuStrip);
|
||||||
Name = "EntityViewForm";
|
Name = "EntityViewForm";
|
||||||
Text = "DataBaseViewer";
|
Text = "DataBaseViewer";
|
||||||
RootSplitContainer.Panel1.ResumeLayout(false);
|
RootSplitContainer.Panel1.ResumeLayout(false);
|
||||||
@@ -220,8 +216,8 @@ partial class EntityViewForm
|
|||||||
ResultSplitContainer.Panel2.PerformLayout();
|
ResultSplitContainer.Panel2.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).EndInit();
|
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).EndInit();
|
||||||
ResultSplitContainer.ResumeLayout(false);
|
ResultSplitContainer.ResumeLayout(false);
|
||||||
MainMenuStrip.ResumeLayout(false);
|
MenuStrip.ResumeLayout(false);
|
||||||
MainMenuStrip.PerformLayout();
|
MenuStrip.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@@ -235,7 +231,7 @@ partial class EntityViewForm
|
|||||||
private TextBox DescriptionTextBox;
|
private TextBox DescriptionTextBox;
|
||||||
private EntityTreeViewerControl EntityTreeViewerControl;
|
private EntityTreeViewerControl EntityTreeViewerControl;
|
||||||
private DatabaseViewerControl DatabaseViewer;
|
private DatabaseViewerControl DatabaseViewer;
|
||||||
private MenuStrip MainMenuStrip;
|
private MenuStrip MenuStrip;
|
||||||
private ToolStripMenuItem FileToolStripMenuItem;
|
private ToolStripMenuItem FileToolStripMenuItem;
|
||||||
private ToolStripMenuItem ExitToolStripMenuItem;
|
private ToolStripMenuItem ExitToolStripMenuItem;
|
||||||
private ToolStripMenuItem WindowsToolStripMenuItem;
|
private ToolStripMenuItem WindowsToolStripMenuItem;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="MainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="MenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
|||||||
+13
-13
@@ -36,7 +36,7 @@ partial class StartForm
|
|||||||
SelectAllButton = new Button();
|
SelectAllButton = new Button();
|
||||||
DeselectAllButton = new Button();
|
DeselectAllButton = new Button();
|
||||||
StartButton = new Button();
|
StartButton = new Button();
|
||||||
MainMenuStrip = new MenuStrip();
|
MenuStrip = new MenuStrip();
|
||||||
FileToolStripMenuItem = new ToolStripMenuItem();
|
FileToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ExitToolStripMenuItem = new ToolStripMenuItem();
|
ExitToolStripMenuItem = new ToolStripMenuItem();
|
||||||
WindowsToolStripMenuItem = new ToolStripMenuItem();
|
WindowsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
@@ -49,7 +49,7 @@ partial class StartForm
|
|||||||
MainSplitContainer.SuspendLayout();
|
MainSplitContainer.SuspendLayout();
|
||||||
PropertiesGroupBox.SuspendLayout();
|
PropertiesGroupBox.SuspendLayout();
|
||||||
ProcessorsGroupBox.SuspendLayout();
|
ProcessorsGroupBox.SuspendLayout();
|
||||||
MainMenuStrip.SuspendLayout();
|
MenuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// MainSplitContainer
|
// MainSplitContainer
|
||||||
@@ -143,14 +143,14 @@ partial class StartForm
|
|||||||
StartButton.UseVisualStyleBackColor = true;
|
StartButton.UseVisualStyleBackColor = true;
|
||||||
StartButton.Click += StartButton_Click;
|
StartButton.Click += StartButton_Click;
|
||||||
//
|
//
|
||||||
// MainMenuStrip
|
// MenuStrip
|
||||||
//
|
//
|
||||||
MainMenuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem, WindowsToolStripMenuItem, StartToolStripMenuItem });
|
MenuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem, WindowsToolStripMenuItem, StartToolStripMenuItem });
|
||||||
MainMenuStrip.Location = new Point(0, 0);
|
MenuStrip.Location = new Point(0, 0);
|
||||||
MainMenuStrip.Name = "MainMenuStrip";
|
MenuStrip.Name = "MenuStrip";
|
||||||
MainMenuStrip.Size = new Size(931, 24);
|
MenuStrip.Size = new Size(931, 24);
|
||||||
MainMenuStrip.TabIndex = 1;
|
MenuStrip.TabIndex = 1;
|
||||||
MainMenuStrip.Text = "menuStrip1";
|
MenuStrip.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
// FileToolStripMenuItem
|
// FileToolStripMenuItem
|
||||||
//
|
//
|
||||||
@@ -200,7 +200,7 @@ partial class StartForm
|
|||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(931, 677);
|
ClientSize = new Size(931, 677);
|
||||||
Controls.Add(MainSplitContainer);
|
Controls.Add(MainSplitContainer);
|
||||||
Controls.Add(MainMenuStrip);
|
Controls.Add(MenuStrip);
|
||||||
Name = "StartForm";
|
Name = "StartForm";
|
||||||
Text = "Настройки импорта данных";
|
Text = "Настройки импорта данных";
|
||||||
Load += StartForm_Load;
|
Load += StartForm_Load;
|
||||||
@@ -210,8 +210,8 @@ partial class StartForm
|
|||||||
MainSplitContainer.ResumeLayout(false);
|
MainSplitContainer.ResumeLayout(false);
|
||||||
PropertiesGroupBox.ResumeLayout(false);
|
PropertiesGroupBox.ResumeLayout(false);
|
||||||
ProcessorsGroupBox.ResumeLayout(false);
|
ProcessorsGroupBox.ResumeLayout(false);
|
||||||
MainMenuStrip.ResumeLayout(false);
|
MenuStrip.ResumeLayout(false);
|
||||||
MainMenuStrip.PerformLayout();
|
MenuStrip.PerformLayout();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ partial class StartForm
|
|||||||
private Button SelectAllButton;
|
private Button SelectAllButton;
|
||||||
private Button DeselectAllButton;
|
private Button DeselectAllButton;
|
||||||
private Controls.ProcessorCollectionControl ProcessorCollectionControl;
|
private Controls.ProcessorCollectionControl ProcessorCollectionControl;
|
||||||
private MenuStrip MainMenuStrip;
|
private MenuStrip MenuStrip;
|
||||||
private ToolStripMenuItem FileToolStripMenuItem;
|
private ToolStripMenuItem FileToolStripMenuItem;
|
||||||
private ToolStripMenuItem ExitToolStripMenuItem;
|
private ToolStripMenuItem ExitToolStripMenuItem;
|
||||||
private ToolStripMenuItem WindowsToolStripMenuItem;
|
private ToolStripMenuItem WindowsToolStripMenuItem;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="MainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="MenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
-32
@@ -7,7 +7,6 @@ using Pf2eDataScrapper.Processors;
|
|||||||
using Pf2eModel;
|
using Pf2eModel;
|
||||||
using Pf2eModel.Model;
|
using Pf2eModel.Model;
|
||||||
using Pf2eModel.Model.Base;
|
using Pf2eModel.Model.Base;
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
using Pf2eModel.Model.Base.Source;
|
using Pf2eModel.Model.Base.Source;
|
||||||
using Pf2eModel.Model.Base.Targets;
|
using Pf2eModel.Model.Base.Targets;
|
||||||
using Pf2eModel.Model.Common.I18n;
|
using Pf2eModel.Model.Common.I18n;
|
||||||
@@ -59,17 +58,10 @@ internal abstract class AbstractEntityProcessor(
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
if (Input.GetOptional<JArray>("remaster_id") is not null)
|
|
||||||
{
|
|
||||||
throw new LegacyItemException(Input.GetOptional<string>("name", ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
AddEntity();
|
AddEntity();
|
||||||
AddSource();
|
AddSource();
|
||||||
AddExternal();
|
AddExternal();
|
||||||
AddTraits();
|
AddTraits();
|
||||||
|
|
||||||
AddLegacy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -229,29 +221,5 @@ internal abstract class AbstractEntityProcessor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление устаревших сущностей.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual void AddLegacy()
|
|
||||||
{
|
|
||||||
JArray? legacyIdArray = Input.GetOptional<JArray>("legacy_id");
|
|
||||||
|
|
||||||
if (legacyIdArray is null || legacyIdArray.Count == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string[] legacyIds = legacyIdArray.ToArray().Select(t => t.ToString()).ToArray();
|
|
||||||
List<LegacyEntity> legacyEntities = Context
|
|
||||||
.LegacyEntityExternals.Where(lee => legacyIds.Contains(lee.ExternalId))
|
|
||||||
.Select(lee => lee.LegacyEntity)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
foreach (LegacyEntity legacyEntity in legacyEntities)
|
|
||||||
{
|
|
||||||
Entity.LegacyEntities.Add(legacyEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
-111
@@ -1,111 +0,0 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Pf2eDataScrapper.App;
|
|
||||||
using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers;
|
|
||||||
using Pf2eDataScrapper.Processors;
|
|
||||||
using Pf2eModel;
|
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
using Pf2eModel.Model.Common.I18n;
|
|
||||||
using StringHelper = Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers.StringHelper;
|
|
||||||
|
|
||||||
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Processors.Common;
|
|
||||||
|
|
||||||
[ProcessorCollection(
|
|
||||||
"aonprd:legacy",
|
|
||||||
InnerType = null,
|
|
||||||
CompendiumType = ProcessorCompendiumEnum.Aonprd,
|
|
||||||
Description = "Создание ссылок на устаревшие сущности",
|
|
||||||
Group = ProcessorGroupEnum.AonprdPreparation,
|
|
||||||
Parallel = true
|
|
||||||
)]
|
|
||||||
[ProcessorDependencies(["aonprd:source", "aonprd:external"])]
|
|
||||||
internal class LegacyProcessor(
|
|
||||||
ProcessorInput input,
|
|
||||||
AonprdBuilderGlobals globals,
|
|
||||||
StringHelper stringHelper
|
|
||||||
) : AbstractInputProcessor(input)
|
|
||||||
{
|
|
||||||
public Pf2eDbContext Context { get; } = new();
|
|
||||||
public AonprdBuilderGlobals Globals { get; } = globals;
|
|
||||||
public StringHelper StringHelper { get; } = stringHelper;
|
|
||||||
|
|
||||||
private LegacyEntity LegacyEntity { get; set; } = null!;
|
|
||||||
|
|
||||||
public override void Process()
|
|
||||||
{
|
|
||||||
if (Input.GetOptional<JArray>("remaster_id") is null)
|
|
||||||
{
|
|
||||||
throw new SilentSkipItemException();
|
|
||||||
}
|
|
||||||
|
|
||||||
LegacyEntity = new()
|
|
||||||
{
|
|
||||||
Name = { [LocaleType.English] = Input.GetOptional<string>("name", "sidebar-29") },
|
|
||||||
};
|
|
||||||
|
|
||||||
AddSource();
|
|
||||||
AddExternal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Генерация источников сущности.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual void AddSource()
|
|
||||||
{
|
|
||||||
string[] sourceNames = Input
|
|
||||||
.GetRequired<JArray>("source")
|
|
||||||
.Select(token => token.ToString())
|
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
if (sourceNames.Length == 0)
|
|
||||||
{
|
|
||||||
throw new(
|
|
||||||
$"Source for entity with id \"{LegacyEntity.Name[LocaleType.English]}\" "
|
|
||||||
+ $"(Aonprd id \"{Input.GetRequired<string>("id")}\") is not found"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
Dictionary<string, int> sourceIds = Context
|
|
||||||
.Sources.AsNoTracking()
|
|
||||||
.Where(s => sourceNames.Contains(s.Name))
|
|
||||||
.ToDictionary(s => s.Name, s => s.Id);
|
|
||||||
*/
|
|
||||||
foreach (string sourceName in sourceNames)
|
|
||||||
{
|
|
||||||
LegacyEntitySource entitySource = new()
|
|
||||||
{
|
|
||||||
LegacyEntity = LegacyEntity,
|
|
||||||
SourceId = Globals.SourceIds[sourceName],
|
|
||||||
Suffix = StringHelper.ResolveSource(Input.GetRequired<string>("source_markdown")),
|
|
||||||
IsRemaster = Input.GetOptional<JArray>("legacy_id") is not null,
|
|
||||||
};
|
|
||||||
|
|
||||||
Context.LegacyEntitySources.Add(entitySource);
|
|
||||||
LegacyEntity.Sources.Add(entitySource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Генерация внешних ссылок сущности.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual void AddExternal()
|
|
||||||
{
|
|
||||||
LegacyEntityExternal external = new()
|
|
||||||
{
|
|
||||||
LegacyEntity = LegacyEntity,
|
|
||||||
TargetId = Globals.AonprdTarget.Id,
|
|
||||||
ExternalId = Input.GetRequired<string>("id"),
|
|
||||||
Suffix = Input.GetRequired<string>("url"),
|
|
||||||
Md5 = Input.Md5(),
|
|
||||||
};
|
|
||||||
|
|
||||||
Context.LegacyEntityExternals.Add(external);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Save()
|
|
||||||
{
|
|
||||||
Context.LegacyEntities.Add(LegacyEntity);
|
|
||||||
|
|
||||||
Context.SaveChanges(false);
|
|
||||||
Context.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
using Pf2eDataScrapper.Helpers;
|
using Pf2eDataScrapper.Helpers;
|
||||||
using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers;
|
using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers;
|
||||||
using Pf2eDataScrapper.Processors;
|
using Pf2eDataScrapper.Processors;
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
using Pf2eModel.Model.Common.I18n;
|
using Pf2eModel.Model.Common.I18n;
|
||||||
using Pf2eModel.Model.Enum;
|
using Pf2eModel.Model.Enum;
|
||||||
using Pf2eModel.Model.Structure;
|
using Pf2eModel.Model.Structure;
|
||||||
@@ -37,11 +36,6 @@ internal class TraitProcessor(
|
|||||||
Context.Traits.Add(Object);
|
Context.Traits.Add(Object);
|
||||||
|
|
||||||
Globals.TraitIds[Entity.Name[LocaleType.English]] = Entity.Id;
|
Globals.TraitIds[Entity.Name[LocaleType.English]] = Entity.Id;
|
||||||
|
|
||||||
foreach (LegacyEntity legacyEntity in Entity.LegacyEntities)
|
|
||||||
{
|
|
||||||
Globals.TraitIds[legacyEntity.Name[LocaleType.English]] = Entity.Id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ internal abstract class FoundryEnAbstractProcessor(
|
|||||||
{
|
{
|
||||||
Type = LocaleType.English,
|
Type = LocaleType.English,
|
||||||
Alias = Entity.Group,
|
Alias = Entity.Group,
|
||||||
EntityId = Entity.Id,
|
LegacyId = Entity.Id,
|
||||||
Entity = Entity
|
Entity = Entity
|
||||||
};
|
};
|
||||||
Context.EntityAliases.Add(alias);
|
Context.EntityAliases.Add(alias);
|
||||||
|
|||||||
+97
-172
@@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum;
|
|||||||
namespace Pf2eModel.Migrations
|
namespace Pf2eModel.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(Pf2eDbContext))]
|
[DbContext(typeof(Pf2eDbContext))]
|
||||||
[Migration("20250514120355_1")]
|
[Migration("20250515054227_1")]
|
||||||
partial class _1
|
partial class _1
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -86,25 +86,6 @@ namespace Pf2eModel.Migrations
|
|||||||
b.ToTable("entity_keyword", (string)null);
|
b.ToTable("entity_keyword", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("EntityLegacyEntity", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("LegacyEntitiesId")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("legacy_entities_id");
|
|
||||||
|
|
||||||
b.Property<int>("RemasterEntitiesId")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("remaster_entities_id");
|
|
||||||
|
|
||||||
b.HasKey("LegacyEntitiesId", "RemasterEntitiesId")
|
|
||||||
.HasName("pk_entity_legacy_entity");
|
|
||||||
|
|
||||||
b.HasIndex("RemasterEntitiesId")
|
|
||||||
.HasDatabaseName("ix_entity_legacy_entity_remaster_entities_id");
|
|
||||||
|
|
||||||
b.ToTable("entity_legacy_entity", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("EntityTrait", b =>
|
modelBuilder.Entity("EntityTrait", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("EntitiesId")
|
b.Property<int>("EntitiesId")
|
||||||
@@ -194,6 +175,40 @@ namespace Pf2eModel.Migrations
|
|||||||
b.ToTable("entities", (string)null);
|
b.ToTable("entities", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Pf2eModel.Model.Base.EntityAlias", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id")
|
||||||
|
.HasColumnOrder(1)
|
||||||
|
.HasComment("Идентификатор");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("EntityId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("entity_id")
|
||||||
|
.HasColumnOrder(2)
|
||||||
|
.HasComment("Связанная сущность");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasColumnType("character varying(255)")
|
||||||
|
.HasColumnName("name")
|
||||||
|
.HasColumnOrder(3)
|
||||||
|
.HasComment("Алиас");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_entity_aliases");
|
||||||
|
|
||||||
|
b.HasIndex("EntityId")
|
||||||
|
.HasDatabaseName("ix_entity_aliases_entity_id");
|
||||||
|
|
||||||
|
b.ToTable("entity_aliases", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.Keyword", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.Keyword", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -259,121 +274,52 @@ namespace Pf2eModel.Migrations
|
|||||||
b.ToTable("keyword_aliases", (string)null);
|
b.ToTable("keyword_aliases", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.LegacyRemaster", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("LegacyId")
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("id")
|
.HasColumnName("legacy_id")
|
||||||
.HasColumnOrder(1);
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("jsonb")
|
|
||||||
.HasColumnName("name")
|
|
||||||
.HasColumnOrder(2)
|
|
||||||
.HasComment("Отображаемое имя");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
|
||||||
.HasName("pk_legacy_entities");
|
|
||||||
|
|
||||||
b.ToTable("legacy_entities", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("LegacyEntityId")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("legacy_entity_id")
|
|
||||||
.HasColumnOrder(1)
|
.HasColumnOrder(1)
|
||||||
.HasComment("Идентификатор сущности");
|
.HasComment("Идентификатор сущности");
|
||||||
|
|
||||||
b.Property<int>("TargetId")
|
b.Property<int>("RemasterId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("target_id")
|
.HasColumnName("remaster_id")
|
||||||
.HasColumnOrder(2)
|
.HasColumnOrder(2)
|
||||||
.HasComment("Идентификатор цели");
|
.HasComment("Идентификатор цели");
|
||||||
|
|
||||||
b.Property<string>("ExternalId")
|
b.Property<int>("LegacyEntitiesId")
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("external_id")
|
|
||||||
.HasColumnOrder(3);
|
|
||||||
|
|
||||||
b.Property<string>("Md5")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(32)
|
|
||||||
.HasColumnType("character varying(32)")
|
|
||||||
.HasColumnName("md5")
|
|
||||||
.HasColumnOrder(5)
|
|
||||||
.HasComment("Контрольная сумма объекта");
|
|
||||||
|
|
||||||
b.Property<string>("Suffix")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("suffix")
|
|
||||||
.HasColumnOrder(4)
|
|
||||||
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
|
|
||||||
|
|
||||||
b.HasKey("LegacyEntityId", "TargetId")
|
|
||||||
.HasName("pk_legacy_entity_externals");
|
|
||||||
|
|
||||||
b.HasIndex("TargetId")
|
|
||||||
.HasDatabaseName("ix_legacy_entity_externals_target_id");
|
|
||||||
|
|
||||||
b.ToTable("legacy_entity_externals", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("id")
|
.HasColumnName("legacy_entities_id");
|
||||||
.HasColumnOrder(0)
|
|
||||||
.HasComment("Идентификатор");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<bool>("IsRemaster")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_remaster")
|
|
||||||
.HasColumnOrder(4)
|
|
||||||
.HasComment("Флаг, указывающий, что объект является частью ремастера");
|
|
||||||
|
|
||||||
b.Property<int>("LegacyEntityId")
|
b.Property<int>("LegacyEntityId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("legacy_entity_id")
|
.HasColumnName("legacy_entity_id");
|
||||||
.HasColumnOrder(1)
|
|
||||||
.HasComment("Идентификатор устаревшей сущности");
|
|
||||||
|
|
||||||
b.Property<int>("SourceId")
|
b.Property<int>("RemasterEntitiesId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("source_id")
|
.HasColumnName("remaster_entities_id");
|
||||||
.HasColumnOrder(2)
|
|
||||||
.HasComment("Идентификатор источника");
|
|
||||||
|
|
||||||
b.Property<string>("Suffix")
|
b.Property<int>("RemasterEntityId")
|
||||||
.IsRequired()
|
.HasColumnType("integer")
|
||||||
.HasMaxLength(255)
|
.HasColumnName("remaster_entity_id");
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("suffix")
|
|
||||||
.HasColumnOrder(3)
|
|
||||||
.HasComment("Номер страницы, эррата и т.д.");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("LegacyId", "RemasterId")
|
||||||
.HasName("pk_legacy_entity_sources");
|
.HasName("pk_legacy_remasters");
|
||||||
|
|
||||||
|
b.HasIndex("LegacyEntitiesId")
|
||||||
|
.HasDatabaseName("ix_legacy_remasters_legacy_entities_id");
|
||||||
|
|
||||||
b.HasIndex("LegacyEntityId")
|
b.HasIndex("LegacyEntityId")
|
||||||
.HasDatabaseName("ix_legacy_entity_sources_legacy_entity_id");
|
.HasDatabaseName("ix_legacy_remasters_legacy_entity_id");
|
||||||
|
|
||||||
b.HasIndex("SourceId")
|
b.HasIndex("RemasterEntitiesId")
|
||||||
.HasDatabaseName("ix_legacy_entity_sources_source_id");
|
.HasDatabaseName("ix_legacy_remasters_remaster_entities_id");
|
||||||
|
|
||||||
b.ToTable("legacy_entity_sources", (string)null);
|
b.HasIndex("RemasterEntityId")
|
||||||
|
.HasDatabaseName("ix_legacy_remasters_remaster_entity_id");
|
||||||
|
|
||||||
|
b.ToTable("legacy_remasters", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
||||||
@@ -1984,23 +1930,6 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasConstraintName("fk_entity_keyword_keywords_keywords_id");
|
.HasConstraintName("fk_entity_keyword_keywords_keywords_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("EntityLegacyEntity", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("LegacyEntitiesId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_entity_legacy_entity_legacy_entities_legacy_entities_id");
|
|
||||||
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RemasterEntitiesId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_entity_legacy_entity_entities_remaster_entities_id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("EntityTrait", b =>
|
modelBuilder.Entity("EntityTrait", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
||||||
@@ -2018,6 +1947,18 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasConstraintName("fk_entity_trait_traits_traits_id");
|
.HasConstraintName("fk_entity_trait_traits_traits_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Pf2eModel.Model.Base.EntityAlias", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
|
||||||
|
.WithMany("Aliases")
|
||||||
|
.HasForeignKey("EntityId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_entity_aliases_entities_entity_id");
|
||||||
|
|
||||||
|
b.Navigation("Entity");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.KeywordAlias", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.KeywordAlias", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Base.Keywords.Keyword", "Keyword")
|
b.HasOne("Pf2eModel.Model.Base.Keywords.Keyword", "Keyword")
|
||||||
@@ -2030,46 +1971,39 @@ namespace Pf2eModel.Migrations
|
|||||||
b.Navigation("Keyword");
|
b.Navigation("Keyword");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.LegacyRemaster", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
|
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
||||||
.WithMany("Externals")
|
.WithMany()
|
||||||
|
.HasForeignKey("LegacyEntitiesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_legacy_remasters_entities_legacy_entities_id");
|
||||||
|
|
||||||
|
b.HasOne("Pf2eModel.Model.Base.Entity", "LegacyEntity")
|
||||||
|
.WithMany()
|
||||||
.HasForeignKey("LegacyEntityId")
|
.HasForeignKey("LegacyEntityId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasConstraintName("fk_legacy_entity_externals_legacy_entities_legacy_entity_id");
|
.HasConstraintName("fk_legacy_remasters_entities_legacy_entity_id");
|
||||||
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Targets.ExternalTarget", "Target")
|
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
||||||
.WithMany("LegacyEntityExternals")
|
.WithMany()
|
||||||
.HasForeignKey("TargetId")
|
.HasForeignKey("RemasterEntitiesId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasConstraintName("fk_legacy_entity_externals_external_targets_target_id");
|
.HasConstraintName("fk_legacy_remasters_entities_remaster_entities_id");
|
||||||
|
|
||||||
|
b.HasOne("Pf2eModel.Model.Base.Entity", "RemasterEntity")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RemasterEntityId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_legacy_remasters_entities_remaster_entity_id");
|
||||||
|
|
||||||
b.Navigation("LegacyEntity");
|
b.Navigation("LegacyEntity");
|
||||||
|
|
||||||
b.Navigation("Target");
|
b.Navigation("RemasterEntity");
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
|
|
||||||
.WithMany("Sources")
|
|
||||||
.HasForeignKey("LegacyEntityId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_legacy_entity_sources_legacy_entities_legacy_entity_id");
|
|
||||||
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Source.Source", "Source")
|
|
||||||
.WithMany("LegacyEntitySources")
|
|
||||||
.HasForeignKey("SourceId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_legacy_entity_sources_sources_source_id");
|
|
||||||
|
|
||||||
b.Navigation("LegacyEntity");
|
|
||||||
|
|
||||||
b.Navigation("Source");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
||||||
@@ -2700,6 +2634,8 @@ namespace Pf2eModel.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Entity", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Entity", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("Aliases");
|
||||||
|
|
||||||
b.Navigation("Externals");
|
b.Navigation("Externals");
|
||||||
|
|
||||||
b.Navigation("Sources");
|
b.Navigation("Sources");
|
||||||
@@ -2710,25 +2646,14 @@ namespace Pf2eModel.Migrations
|
|||||||
b.Navigation("Aliases");
|
b.Navigation("Aliases");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Externals");
|
|
||||||
|
|
||||||
b.Navigation("Sources");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Source.Source", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Source.Source", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("EntitySources");
|
b.Navigation("EntitySources");
|
||||||
|
|
||||||
b.Navigation("LegacyEntitySources");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Targets.ExternalTarget", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Targets.ExternalTarget", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("EntityExternals");
|
b.Navigation("EntityExternals");
|
||||||
|
|
||||||
b.Navigation("LegacyEntityExternals");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.Ancestry", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.Ancestry", b =>
|
||||||
+88
-121
@@ -101,19 +101,6 @@ namespace Pf2eModel.Migrations
|
|||||||
table.PrimaryKey("pk_keywords", x => x.id);
|
table.PrimaryKey("pk_keywords", x => x.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "legacy_entities",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
name = table.Column<string>(type: "jsonb", nullable: false, comment: "Отображаемое имя")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("pk_legacy_entities", x => x.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "sources",
|
name: "sources",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -261,6 +248,26 @@ namespace Pf2eModel.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "entity_aliases",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
entity_id = table.Column<int>(type: "integer", nullable: false, comment: "Связанная сущность"),
|
||||||
|
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Алиас")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_entity_aliases", x => x.id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_entity_aliases_entities_entity_id",
|
||||||
|
column: x => x.entity_id,
|
||||||
|
principalTable: "entities",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "feats",
|
name: "feats",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -304,6 +311,46 @@ namespace Pf2eModel.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "legacy_remasters",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
legacy_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор сущности"),
|
||||||
|
remaster_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор цели"),
|
||||||
|
legacy_entity_id = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
remaster_entity_id = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
legacy_entities_id = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
remaster_entities_id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("pk_legacy_remasters", x => new { x.legacy_id, x.remaster_id });
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_legacy_remasters_entities_legacy_entities_id",
|
||||||
|
column: x => x.legacy_entities_id,
|
||||||
|
principalTable: "entities",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_legacy_remasters_entities_legacy_entity_id",
|
||||||
|
column: x => x.legacy_entity_id,
|
||||||
|
principalTable: "entities",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_legacy_remasters_entities_remaster_entities_id",
|
||||||
|
column: x => x.remaster_entities_id,
|
||||||
|
principalTable: "entities",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "fk_legacy_remasters_entities_remaster_entity_id",
|
||||||
|
column: x => x.remaster_entity_id,
|
||||||
|
principalTable: "entities",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "rituals",
|
name: "rituals",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -477,57 +524,6 @@ namespace Pf2eModel.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "entity_legacy_entity",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
legacy_entities_id = table.Column<int>(type: "integer", nullable: false),
|
|
||||||
remaster_entities_id = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("pk_entity_legacy_entity", x => new { x.legacy_entities_id, x.remaster_entities_id });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_entity_legacy_entity_entities_remaster_entities_id",
|
|
||||||
column: x => x.remaster_entities_id,
|
|
||||||
principalTable: "entities",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_entity_legacy_entity_legacy_entities_legacy_entities_id",
|
|
||||||
column: x => x.legacy_entities_id,
|
|
||||||
principalTable: "legacy_entities",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "legacy_entity_externals",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
legacy_entity_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор сущности"),
|
|
||||||
target_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор цели"),
|
|
||||||
external_id = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
|
||||||
suffix = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Часть URL до объекта. Для источников Foundry - полный UUID объекта"),
|
|
||||||
md5 = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: false, comment: "Контрольная сумма объекта")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("pk_legacy_entity_externals", x => new { x.legacy_entity_id, x.target_id });
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_legacy_entity_externals_external_targets_target_id",
|
|
||||||
column: x => x.target_id,
|
|
||||||
principalTable: "external_targets",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_legacy_entity_externals_legacy_entities_legacy_entity_id",
|
|
||||||
column: x => x.legacy_entity_id,
|
|
||||||
principalTable: "legacy_entities",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "entity_sources",
|
name: "entity_sources",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -556,34 +552,6 @@ namespace Pf2eModel.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "legacy_entity_sources",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
legacy_entity_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор устаревшей сущности"),
|
|
||||||
source_id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор источника"),
|
|
||||||
suffix = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Номер страницы, эррата и т.д."),
|
|
||||||
is_remaster = table.Column<bool>(type: "boolean", nullable: false, comment: "Флаг, указывающий, что объект является частью ремастера")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("pk_legacy_entity_sources", x => x.id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_legacy_entity_sources_legacy_entities_legacy_entity_id",
|
|
||||||
column: x => x.legacy_entity_id,
|
|
||||||
principalTable: "legacy_entities",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "fk_legacy_entity_sources_sources_source_id",
|
|
||||||
column: x => x.source_id,
|
|
||||||
principalTable: "sources",
|
|
||||||
principalColumn: "id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "ancestry_boosts",
|
name: "ancestry_boosts",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -1343,6 +1311,11 @@ namespace Pf2eModel.Migrations
|
|||||||
table: "deity_weapons",
|
table: "deity_weapons",
|
||||||
column: "deity_id");
|
column: "deity_id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_entity_aliases_entity_id",
|
||||||
|
table: "entity_aliases",
|
||||||
|
column: "entity_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_entity_externals_target_id",
|
name: "ix_entity_externals_target_id",
|
||||||
table: "entity_externals",
|
table: "entity_externals",
|
||||||
@@ -1353,11 +1326,6 @@ namespace Pf2eModel.Migrations
|
|||||||
table: "entity_keyword",
|
table: "entity_keyword",
|
||||||
column: "keywords_id");
|
column: "keywords_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "ix_entity_legacy_entity_remaster_entities_id",
|
|
||||||
table: "entity_legacy_entity",
|
|
||||||
column: "remaster_entities_id");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_entity_sources_entity_id",
|
name: "ix_entity_sources_entity_id",
|
||||||
table: "entity_sources",
|
table: "entity_sources",
|
||||||
@@ -1394,19 +1362,24 @@ namespace Pf2eModel.Migrations
|
|||||||
column: "entity_id");
|
column: "entity_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_legacy_entity_externals_target_id",
|
name: "ix_legacy_remasters_legacy_entities_id",
|
||||||
table: "legacy_entity_externals",
|
table: "legacy_remasters",
|
||||||
column: "target_id");
|
column: "legacy_entities_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_legacy_entity_sources_legacy_entity_id",
|
name: "ix_legacy_remasters_legacy_entity_id",
|
||||||
table: "legacy_entity_sources",
|
table: "legacy_remasters",
|
||||||
column: "legacy_entity_id");
|
column: "legacy_entity_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_legacy_entity_sources_source_id",
|
name: "ix_legacy_remasters_remaster_entities_id",
|
||||||
table: "legacy_entity_sources",
|
table: "legacy_remasters",
|
||||||
column: "source_id");
|
column: "remaster_entities_id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_legacy_remasters_remaster_entity_id",
|
||||||
|
table: "legacy_remasters",
|
||||||
|
column: "remaster_entity_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_ritual_checks_ritual_id",
|
name: "ix_ritual_checks_ritual_id",
|
||||||
@@ -1518,15 +1491,15 @@ namespace Pf2eModel.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "deity_weapons");
|
name: "deity_weapons");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "entity_aliases");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "entity_externals");
|
name: "entity_externals");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "entity_keyword");
|
name: "entity_keyword");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "entity_legacy_entity");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "entity_sources");
|
name: "entity_sources");
|
||||||
|
|
||||||
@@ -1546,10 +1519,7 @@ namespace Pf2eModel.Migrations
|
|||||||
name: "keyword_aliases");
|
name: "keyword_aliases");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "legacy_entity_externals");
|
name: "legacy_remasters");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "legacy_entity_sources");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ritual_areas");
|
name: "ritual_areas");
|
||||||
@@ -1587,6 +1557,12 @@ namespace Pf2eModel.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "deities");
|
name: "deities");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "external_targets");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "sources");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "traits");
|
name: "traits");
|
||||||
|
|
||||||
@@ -1596,15 +1572,6 @@ namespace Pf2eModel.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "keywords");
|
name: "keywords");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "external_targets");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "legacy_entities");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "sources");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "rituals");
|
name: "rituals");
|
||||||
|
|
||||||
@@ -83,25 +83,6 @@ namespace Pf2eModel.Migrations
|
|||||||
b.ToTable("entity_keyword", (string)null);
|
b.ToTable("entity_keyword", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("EntityLegacyEntity", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("LegacyEntitiesId")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("legacy_entities_id");
|
|
||||||
|
|
||||||
b.Property<int>("RemasterEntitiesId")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("remaster_entities_id");
|
|
||||||
|
|
||||||
b.HasKey("LegacyEntitiesId", "RemasterEntitiesId")
|
|
||||||
.HasName("pk_entity_legacy_entity");
|
|
||||||
|
|
||||||
b.HasIndex("RemasterEntitiesId")
|
|
||||||
.HasDatabaseName("ix_entity_legacy_entity_remaster_entities_id");
|
|
||||||
|
|
||||||
b.ToTable("entity_legacy_entity", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("EntityTrait", b =>
|
modelBuilder.Entity("EntityTrait", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("EntitiesId")
|
b.Property<int>("EntitiesId")
|
||||||
@@ -191,6 +172,40 @@ namespace Pf2eModel.Migrations
|
|||||||
b.ToTable("entities", (string)null);
|
b.ToTable("entities", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Pf2eModel.Model.Base.EntityAlias", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("id")
|
||||||
|
.HasColumnOrder(1)
|
||||||
|
.HasComment("Идентификатор");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("EntityId")
|
||||||
|
.HasColumnType("integer")
|
||||||
|
.HasColumnName("entity_id")
|
||||||
|
.HasColumnOrder(2)
|
||||||
|
.HasComment("Связанная сущность");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasColumnType("character varying(255)")
|
||||||
|
.HasColumnName("name")
|
||||||
|
.HasColumnOrder(3)
|
||||||
|
.HasComment("Алиас");
|
||||||
|
|
||||||
|
b.HasKey("Id")
|
||||||
|
.HasName("pk_entity_aliases");
|
||||||
|
|
||||||
|
b.HasIndex("EntityId")
|
||||||
|
.HasDatabaseName("ix_entity_aliases_entity_id");
|
||||||
|
|
||||||
|
b.ToTable("entity_aliases", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.Keyword", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.Keyword", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -256,121 +271,52 @@ namespace Pf2eModel.Migrations
|
|||||||
b.ToTable("keyword_aliases", (string)null);
|
b.ToTable("keyword_aliases", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.LegacyRemaster", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("LegacyId")
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("id")
|
.HasColumnName("legacy_id")
|
||||||
.HasColumnOrder(1);
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("jsonb")
|
|
||||||
.HasColumnName("name")
|
|
||||||
.HasColumnOrder(2)
|
|
||||||
.HasComment("Отображаемое имя");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
|
||||||
.HasName("pk_legacy_entities");
|
|
||||||
|
|
||||||
b.ToTable("legacy_entities", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("LegacyEntityId")
|
|
||||||
.HasColumnType("integer")
|
|
||||||
.HasColumnName("legacy_entity_id")
|
|
||||||
.HasColumnOrder(1)
|
.HasColumnOrder(1)
|
||||||
.HasComment("Идентификатор сущности");
|
.HasComment("Идентификатор сущности");
|
||||||
|
|
||||||
b.Property<int>("TargetId")
|
b.Property<int>("RemasterId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("target_id")
|
.HasColumnName("remaster_id")
|
||||||
.HasColumnOrder(2)
|
.HasColumnOrder(2)
|
||||||
.HasComment("Идентификатор цели");
|
.HasComment("Идентификатор цели");
|
||||||
|
|
||||||
b.Property<string>("ExternalId")
|
b.Property<int>("LegacyEntitiesId")
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("external_id")
|
|
||||||
.HasColumnOrder(3);
|
|
||||||
|
|
||||||
b.Property<string>("Md5")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(32)
|
|
||||||
.HasColumnType("character varying(32)")
|
|
||||||
.HasColumnName("md5")
|
|
||||||
.HasColumnOrder(5)
|
|
||||||
.HasComment("Контрольная сумма объекта");
|
|
||||||
|
|
||||||
b.Property<string>("Suffix")
|
|
||||||
.IsRequired()
|
|
||||||
.HasMaxLength(255)
|
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("suffix")
|
|
||||||
.HasColumnOrder(4)
|
|
||||||
.HasComment("Часть URL до объекта. Для источников Foundry - полный UUID объекта");
|
|
||||||
|
|
||||||
b.HasKey("LegacyEntityId", "TargetId")
|
|
||||||
.HasName("pk_legacy_entity_externals");
|
|
||||||
|
|
||||||
b.HasIndex("TargetId")
|
|
||||||
.HasDatabaseName("ix_legacy_entity_externals_target_id");
|
|
||||||
|
|
||||||
b.ToTable("legacy_entity_externals", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("id")
|
.HasColumnName("legacy_entities_id");
|
||||||
.HasColumnOrder(0)
|
|
||||||
.HasComment("Идентификатор");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<bool>("IsRemaster")
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasColumnName("is_remaster")
|
|
||||||
.HasColumnOrder(4)
|
|
||||||
.HasComment("Флаг, указывающий, что объект является частью ремастера");
|
|
||||||
|
|
||||||
b.Property<int>("LegacyEntityId")
|
b.Property<int>("LegacyEntityId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("legacy_entity_id")
|
.HasColumnName("legacy_entity_id");
|
||||||
.HasColumnOrder(1)
|
|
||||||
.HasComment("Идентификатор устаревшей сущности");
|
|
||||||
|
|
||||||
b.Property<int>("SourceId")
|
b.Property<int>("RemasterEntitiesId")
|
||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("source_id")
|
.HasColumnName("remaster_entities_id");
|
||||||
.HasColumnOrder(2)
|
|
||||||
.HasComment("Идентификатор источника");
|
|
||||||
|
|
||||||
b.Property<string>("Suffix")
|
b.Property<int>("RemasterEntityId")
|
||||||
.IsRequired()
|
.HasColumnType("integer")
|
||||||
.HasMaxLength(255)
|
.HasColumnName("remaster_entity_id");
|
||||||
.HasColumnType("character varying(255)")
|
|
||||||
.HasColumnName("suffix")
|
|
||||||
.HasColumnOrder(3)
|
|
||||||
.HasComment("Номер страницы, эррата и т.д.");
|
|
||||||
|
|
||||||
b.HasKey("Id")
|
b.HasKey("LegacyId", "RemasterId")
|
||||||
.HasName("pk_legacy_entity_sources");
|
.HasName("pk_legacy_remasters");
|
||||||
|
|
||||||
|
b.HasIndex("LegacyEntitiesId")
|
||||||
|
.HasDatabaseName("ix_legacy_remasters_legacy_entities_id");
|
||||||
|
|
||||||
b.HasIndex("LegacyEntityId")
|
b.HasIndex("LegacyEntityId")
|
||||||
.HasDatabaseName("ix_legacy_entity_sources_legacy_entity_id");
|
.HasDatabaseName("ix_legacy_remasters_legacy_entity_id");
|
||||||
|
|
||||||
b.HasIndex("SourceId")
|
b.HasIndex("RemasterEntitiesId")
|
||||||
.HasDatabaseName("ix_legacy_entity_sources_source_id");
|
.HasDatabaseName("ix_legacy_remasters_remaster_entities_id");
|
||||||
|
|
||||||
b.ToTable("legacy_entity_sources", (string)null);
|
b.HasIndex("RemasterEntityId")
|
||||||
|
.HasDatabaseName("ix_legacy_remasters_remaster_entity_id");
|
||||||
|
|
||||||
|
b.ToTable("legacy_remasters", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
||||||
@@ -1981,23 +1927,6 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasConstraintName("fk_entity_keyword_keywords_keywords_id");
|
.HasConstraintName("fk_entity_keyword_keywords_keywords_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("EntityLegacyEntity", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("LegacyEntitiesId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_entity_legacy_entity_legacy_entities_legacy_entities_id");
|
|
||||||
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RemasterEntitiesId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_entity_legacy_entity_entities_remaster_entities_id");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("EntityTrait", b =>
|
modelBuilder.Entity("EntityTrait", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
||||||
@@ -2015,6 +1944,18 @@ namespace Pf2eModel.Migrations
|
|||||||
.HasConstraintName("fk_entity_trait_traits_traits_id");
|
.HasConstraintName("fk_entity_trait_traits_traits_id");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Pf2eModel.Model.Base.EntityAlias", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Pf2eModel.Model.Base.Entity", "Entity")
|
||||||
|
.WithMany("Aliases")
|
||||||
|
.HasForeignKey("EntityId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_entity_aliases_entities_entity_id");
|
||||||
|
|
||||||
|
b.Navigation("Entity");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.KeywordAlias", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Keywords.KeywordAlias", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Base.Keywords.Keyword", "Keyword")
|
b.HasOne("Pf2eModel.Model.Base.Keywords.Keyword", "Keyword")
|
||||||
@@ -2027,46 +1968,39 @@ namespace Pf2eModel.Migrations
|
|||||||
b.Navigation("Keyword");
|
b.Navigation("Keyword");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntityExternal", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.LegacyRemaster", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
|
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
||||||
.WithMany("Externals")
|
.WithMany()
|
||||||
|
.HasForeignKey("LegacyEntitiesId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_legacy_remasters_entities_legacy_entities_id");
|
||||||
|
|
||||||
|
b.HasOne("Pf2eModel.Model.Base.Entity", "LegacyEntity")
|
||||||
|
.WithMany()
|
||||||
.HasForeignKey("LegacyEntityId")
|
.HasForeignKey("LegacyEntityId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasConstraintName("fk_legacy_entity_externals_legacy_entities_legacy_entity_id");
|
.HasConstraintName("fk_legacy_remasters_entities_legacy_entity_id");
|
||||||
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Targets.ExternalTarget", "Target")
|
b.HasOne("Pf2eModel.Model.Base.Entity", null)
|
||||||
.WithMany("LegacyEntityExternals")
|
.WithMany()
|
||||||
.HasForeignKey("TargetId")
|
.HasForeignKey("RemasterEntitiesId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasConstraintName("fk_legacy_entity_externals_external_targets_target_id");
|
.HasConstraintName("fk_legacy_remasters_entities_remaster_entities_id");
|
||||||
|
|
||||||
|
b.HasOne("Pf2eModel.Model.Base.Entity", "RemasterEntity")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("RemasterEntityId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_legacy_remasters_entities_remaster_entity_id");
|
||||||
|
|
||||||
b.Navigation("LegacyEntity");
|
b.Navigation("LegacyEntity");
|
||||||
|
|
||||||
b.Navigation("Target");
|
b.Navigation("RemasterEntity");
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntitySource", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Legacy.LegacyEntity", "LegacyEntity")
|
|
||||||
.WithMany("Sources")
|
|
||||||
.HasForeignKey("LegacyEntityId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_legacy_entity_sources_legacy_entities_legacy_entity_id");
|
|
||||||
|
|
||||||
b.HasOne("Pf2eModel.Model.Base.Source.Source", "Source")
|
|
||||||
.WithMany("LegacyEntitySources")
|
|
||||||
.HasForeignKey("SourceId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_legacy_entity_sources_sources_source_id");
|
|
||||||
|
|
||||||
b.Navigation("LegacyEntity");
|
|
||||||
|
|
||||||
b.Navigation("Source");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Source.EntitySource", b =>
|
||||||
@@ -2697,6 +2631,8 @@ namespace Pf2eModel.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Entity", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Entity", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("Aliases");
|
||||||
|
|
||||||
b.Navigation("Externals");
|
b.Navigation("Externals");
|
||||||
|
|
||||||
b.Navigation("Sources");
|
b.Navigation("Sources");
|
||||||
@@ -2707,25 +2643,14 @@ namespace Pf2eModel.Migrations
|
|||||||
b.Navigation("Aliases");
|
b.Navigation("Aliases");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Legacy.LegacyEntity", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Externals");
|
|
||||||
|
|
||||||
b.Navigation("Sources");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Source.Source", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Source.Source", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("EntitySources");
|
b.Navigation("EntitySources");
|
||||||
|
|
||||||
b.Navigation("LegacyEntitySources");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Base.Targets.ExternalTarget", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Base.Targets.ExternalTarget", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("EntityExternals");
|
b.Navigation("EntityExternals");
|
||||||
|
|
||||||
b.Navigation("LegacyEntityExternals");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pf2eModel.Model.Structure.Ancestry", b =>
|
modelBuilder.Entity("Pf2eModel.Model.Structure.Ancestry", b =>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pf2eModel.Model.Base.Keywords;
|
using Pf2eModel.Model.Base.Keywords;
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
using Pf2eModel.Model.Base.Source;
|
using Pf2eModel.Model.Base.Source;
|
||||||
using Pf2eModel.Model.Base.Targets;
|
using Pf2eModel.Model.Base.Targets;
|
||||||
using Pf2eModel.Model.Common.I18n;
|
using Pf2eModel.Model.Common.I18n;
|
||||||
@@ -81,6 +80,11 @@ public class Entity
|
|||||||
[Comment("Флаг, указывающий, что сущность был проверен и не требует автоматической перезаписи")]
|
[Comment("Флаг, указывающий, что сущность был проверен и не требует автоматической перезаписи")]
|
||||||
public bool? IsChecked { get; set; } = false;
|
public bool? IsChecked { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Коллекция алиасов
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<EntityAlias> Aliases { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Коллекция признаков, связанных с сущностью.
|
/// Коллекция признаков, связанных с сущностью.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -104,5 +108,10 @@ public class Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Коллекция устаревших сущностей.
|
/// Коллекция устаревших сущностей.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICollection<LegacyEntity> LegacyEntities { get; set; } = [];
|
public ICollection<Entity> LegacyEntities { get; set; } = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Коллекция обновлённых сущностей.
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<Entity> RemasterEntities { get; set; } = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Pf2eModel.Model.Base;
|
||||||
|
|
||||||
|
public class EntityAlias
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Идентификатор источника.
|
||||||
|
/// </summary>
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Column(Order = 1)]
|
||||||
|
[Comment("Идентификатор")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Идентификатор связанной сущности.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 2)]
|
||||||
|
[Comment("Связанная сущность")]
|
||||||
|
public int EntityId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Отображаемое имя источника.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 3)]
|
||||||
|
[MaxLength(Pf2eDbContext.NameLength)]
|
||||||
|
[Comment("Алиас")]
|
||||||
|
public string Name { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Связанная
|
||||||
|
/// </summary>
|
||||||
|
public Entity Entity { get; set; } = null!;
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Pf2eModel.Model.Common.I18n;
|
|
||||||
|
|
||||||
namespace Pf2eModel.Model.Base.Legacy;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Информация об устаревшей сущности
|
|
||||||
/// </summary>
|
|
||||||
public class LegacyEntity
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор сущности.
|
|
||||||
/// </summary>
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
[Column(Order = 1)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Отображаемое имя сущности.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 2)]
|
|
||||||
[Comment("Отображаемое имя")]
|
|
||||||
public LocaleString Name { get; set; } = [];
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Коллекция обновлённых сущностей.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<Entity> RemasterEntities { get; set; } = [];
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Коллекция источников, связанных с сущностью.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<LegacyEntitySource> Sources { get; set; } = [];
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Коллекция внешних ссылок, связанных с сущностью.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<LegacyEntityExternal> Externals { get; set; } = [];
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Pf2eModel.Model.Base.Targets;
|
|
||||||
|
|
||||||
namespace Pf2eModel.Model.Base.Legacy;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Внешняя ссылка сущности.
|
|
||||||
/// </summary>
|
|
||||||
[PrimaryKey(nameof(LegacyEntityId), nameof(TargetId))]
|
|
||||||
public class LegacyEntityExternal
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор сущности.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 1)]
|
|
||||||
[Comment("Идентификатор сущности")]
|
|
||||||
public int LegacyEntityId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор цели.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 2)]
|
|
||||||
[Comment("Идентификатор цели")]
|
|
||||||
public int TargetId { get; set; }
|
|
||||||
|
|
||||||
[Column(Order = 3)]
|
|
||||||
[MaxLength(255)]
|
|
||||||
public string? ExternalId { get; set; } = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конечная часть URL внешней ссылки.
|
|
||||||
/// Для источников Foundry - полный UUID объекта.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 4)]
|
|
||||||
[MaxLength(255)]
|
|
||||||
[Comment("Часть URL до объекта. Для источников Foundry - полный UUID объекта")]
|
|
||||||
public string Suffix { get; set; } = "";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Контрольная сумма объекта.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 5)]
|
|
||||||
[MaxLength(32)]
|
|
||||||
[Comment("Контрольная сумма объекта")]
|
|
||||||
public string Md5 { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Сущность, которая ссылается на внешнюю ссылку.
|
|
||||||
/// </summary>
|
|
||||||
public LegacyEntity LegacyEntity { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Цель внешней ссылки.
|
|
||||||
/// </summary>
|
|
||||||
public ExternalTarget Target { get; set; } = null!;
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace Pf2eModel.Model.Base.Legacy;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Связь между сущностью и источником.
|
|
||||||
/// </summary>
|
|
||||||
public class LegacyEntitySource
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор связи.
|
|
||||||
/// </summary>
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
[Column(Order = 0)]
|
|
||||||
[Comment("Идентификатор")]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор устаревшей сущности.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 1)]
|
|
||||||
[Comment("Идентификатор устаревшей сущности")]
|
|
||||||
public int LegacyEntityId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Идентификатор источника.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 2)]
|
|
||||||
[Comment("Идентификатор источника")]
|
|
||||||
public int SourceId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Дополнительная информация о источнике, например, номер страницы, номер тома и т.д.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 3)]
|
|
||||||
[MaxLength(255)]
|
|
||||||
[Comment("Номер страницы, эррата и т.д.")]
|
|
||||||
public string Suffix { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Флаг, указывающий, что объект является частью ремастера.
|
|
||||||
/// </summary>
|
|
||||||
[Column(Order = 4)]
|
|
||||||
[Comment("Флаг, указывающий, что объект является частью ремастера")]
|
|
||||||
public bool IsRemaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Сущность, к которой относится источник.
|
|
||||||
/// </summary>
|
|
||||||
public LegacyEntity LegacyEntity { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Источник, к которому относится сущность.
|
|
||||||
/// </summary>
|
|
||||||
public Source.Source Source { get; set; } = null!;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Pf2eModel.Model.Base;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Связь устаревших и обновлённых сущностей
|
||||||
|
/// </summary>
|
||||||
|
[PrimaryKey(nameof(LegacyId), nameof(RemasterId))]
|
||||||
|
public class LegacyRemaster
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Идентификатор устаревшей сущности.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 1)]
|
||||||
|
[Comment("Идентификатор сущности")]
|
||||||
|
public int LegacyId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Идентификатор обновлённой сущности.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 2)]
|
||||||
|
[Comment("Идентификатор цели")]
|
||||||
|
public int RemasterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Устаревшая сущность.
|
||||||
|
/// </summary>
|
||||||
|
public Entity LegacyEntity { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обновлённая сущность.
|
||||||
|
/// </summary>
|
||||||
|
public Entity RemasterEntity { get; set; } = null!;
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
using Pf2eModel.Model.Enum;
|
using Pf2eModel.Model.Enum;
|
||||||
|
|
||||||
namespace Pf2eModel.Model.Base.Source;
|
namespace Pf2eModel.Model.Base.Source;
|
||||||
@@ -46,9 +45,4 @@ public class Source
|
|||||||
/// Связанные сущности.
|
/// Связанные сущности.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICollection<EntitySource> EntitySources { get; set; } = [];
|
public ICollection<EntitySource> EntitySources { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Связанные сущности.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<LegacyEntitySource> LegacyEntitySources { get; set; } = [];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
|
|
||||||
namespace Pf2eModel.Model.Base.Targets;
|
namespace Pf2eModel.Model.Base.Targets;
|
||||||
|
|
||||||
@@ -47,9 +46,4 @@ public class ExternalTarget
|
|||||||
/// Коллекция сущностей, которые ссылаются на эту цель.
|
/// Коллекция сущностей, которые ссылаются на эту цель.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICollection<EntityExternal> EntityExternals { get; set; } = [];
|
public ICollection<EntityExternal> EntityExternals { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Коллекция устаревших сущностей, которые ссылаются на эту цель.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<LegacyEntityExternal> LegacyEntityExternals { get; set; } = [];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using dotenv.net.Utilities;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pf2eModel.Model.Base;
|
using Pf2eModel.Model.Base;
|
||||||
using Pf2eModel.Model.Base.Keywords;
|
using Pf2eModel.Model.Base.Keywords;
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
using Pf2eModel.Model.Base.Source;
|
using Pf2eModel.Model.Base.Source;
|
||||||
using Pf2eModel.Model.Base.Targets;
|
using Pf2eModel.Model.Base.Targets;
|
||||||
using Pf2eModel.Model.Common;
|
using Pf2eModel.Model.Common;
|
||||||
@@ -78,6 +77,8 @@ public partial class Pf2eDbContext : DbContext
|
|||||||
|
|
||||||
public virtual DbSet<Entity> Entities { get; set; }
|
public virtual DbSet<Entity> Entities { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<EntityAlias> EntityAliases { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<EntityExternal> EntityExternals { get; set; }
|
public virtual DbSet<EntityExternal> EntityExternals { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<EntitySource> EntitySources { get; set; }
|
public virtual DbSet<EntitySource> EntitySources { get; set; }
|
||||||
@@ -98,11 +99,7 @@ public partial class Pf2eDbContext : DbContext
|
|||||||
|
|
||||||
public virtual DbSet<Language> Languages { get; set; }
|
public virtual DbSet<Language> Languages { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<LegacyEntity> LegacyEntities { get; set; }
|
public virtual DbSet<LegacyRemaster> LegacyRemasters { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<LegacyEntityExternal> LegacyEntityExternals { get; set; }
|
|
||||||
|
|
||||||
public virtual DbSet<LegacyEntitySource> LegacyEntitySources { get; set; }
|
|
||||||
|
|
||||||
public virtual DbSet<Ritual> Rituals { get; set; }
|
public virtual DbSet<Ritual> Rituals { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|||||||
using Pf2eModel.Model;
|
using Pf2eModel.Model;
|
||||||
using Pf2eModel.Model.Base;
|
using Pf2eModel.Model.Base;
|
||||||
using Pf2eModel.Model.Base.Keywords;
|
using Pf2eModel.Model.Base.Keywords;
|
||||||
using Pf2eModel.Model.Base.Legacy;
|
|
||||||
using Pf2eModel.Model.Base.Source;
|
using Pf2eModel.Model.Base.Source;
|
||||||
using Pf2eModel.Model.Base.Targets;
|
using Pf2eModel.Model.Base.Targets;
|
||||||
using Pf2eModel.Model.Common;
|
using Pf2eModel.Model.Common;
|
||||||
@@ -98,6 +97,13 @@ public partial class Pf2eDbContext
|
|||||||
|
|
||||||
entity.HasMany(e => e.Keywords).WithMany(t => t.Entities);
|
entity.HasMany(e => e.Keywords).WithMany(t => t.Entities);
|
||||||
|
|
||||||
|
// EntityAliases
|
||||||
|
entity
|
||||||
|
.HasMany(e => e.Aliases)
|
||||||
|
.WithOne(a => a.Entity)
|
||||||
|
.HasForeignKey(a => a.EntityId)
|
||||||
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
// EntitySource
|
// EntitySource
|
||||||
entity
|
entity
|
||||||
.HasMany(e => e.Sources)
|
.HasMany(e => e.Sources)
|
||||||
@@ -111,28 +117,19 @@ public partial class Pf2eDbContext
|
|||||||
.WithOne(e => e.Entity)
|
.WithOne(e => e.Entity)
|
||||||
.HasForeignKey(e => e.EntityId)
|
.HasForeignKey(e => e.EntityId)
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
});
|
|
||||||
|
|
||||||
// LegacyEntity
|
// LegacyRemaster
|
||||||
modelBuilder.Entity<LegacyEntity>(entity =>
|
|
||||||
{
|
|
||||||
BindLocaleString(entity, l => l.Name);
|
|
||||||
|
|
||||||
entity.HasMany(l => l.RemasterEntities).WithMany(e => e.LegacyEntities);
|
|
||||||
|
|
||||||
// LegacyEntitySource
|
|
||||||
entity
|
entity
|
||||||
.HasMany(e => e.Sources)
|
.HasMany(e => e.LegacyEntities)
|
||||||
.WithOne(e => e.LegacyEntity)
|
.WithMany(e => e.RemasterEntities)
|
||||||
.HasForeignKey(e => e.LegacyEntityId)
|
.UsingEntity<LegacyRemaster>(
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
//l =>
|
||||||
|
// l.HasOne(lr => lr.LegacyEntity).WithMany().HasForeignKey(lr => lr.LegacyId),
|
||||||
// LegacyEntityExternal
|
//r =>
|
||||||
entity
|
// r.HasOne(lr => lr.RemasterEntity)
|
||||||
.HasMany(e => e.Externals)
|
// .WithMany()
|
||||||
.WithOne(e => e.LegacyEntity)
|
// .HasForeignKey(lr => lr.RemasterId)
|
||||||
.HasForeignKey(e => e.LegacyEntityId)
|
);
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Source
|
// Source
|
||||||
@@ -146,12 +143,6 @@ public partial class Pf2eDbContext
|
|||||||
.HasForeignKey(e => e.SourceId)
|
.HasForeignKey(e => e.SourceId)
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
entity
|
|
||||||
.HasMany(s => s.LegacyEntitySources)
|
|
||||||
.WithOne(e => e.Source)
|
|
||||||
.HasForeignKey(e => e.SourceId)
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
// + EntitySource
|
// + EntitySource
|
||||||
});
|
});
|
||||||
modelBuilder.Entity<EntitySource>(entity => { });
|
modelBuilder.Entity<EntitySource>(entity => { });
|
||||||
@@ -164,12 +155,6 @@ public partial class Pf2eDbContext
|
|||||||
.WithOne(e => e.Target)
|
.WithOne(e => e.Target)
|
||||||
.HasForeignKey(e => e.TargetId)
|
.HasForeignKey(e => e.TargetId)
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
entity
|
|
||||||
.HasMany(t => t.LegacyEntityExternals)
|
|
||||||
.WithOne(e => e.Target)
|
|
||||||
.HasForeignKey(e => e.TargetId)
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
});
|
});
|
||||||
modelBuilder.Entity<EntityExternal>(entity => { });
|
modelBuilder.Entity<EntityExternal>(entity => { });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user