Изменить миграцию по части DataSourceSystem

This commit is contained in:
Roman Efremov 2024-12-13 11:00:41 +05:00
parent ba75f2c888
commit 8f76400d77
2 changed files with 14 additions and 14 deletions

View File

@ -11,16 +11,16 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "DrillingSystem", name: "DataSourceSystem",
columns: table => new columns: table => new
{ {
SystemId = table.Column<Guid>(type: "uuid", nullable: false, comment: "Id системы автобурения"), SystemId = table.Column<Guid>(type: "uuid", nullable: false, comment: "Id системы - источника данных"),
Name = table.Column<string>(type: "varchar(256)", nullable: false, comment: "Наименование системы автобурения"), Name = table.Column<string>(type: "varchar(256)", nullable: false, comment: "Наименование системы - источника данных"),
Description = table.Column<string>(type: "text", nullable: true, comment: "Описание системы автобурения") Description = table.Column<string>(type: "text", nullable: true, comment: "Описание системы - источника данных")
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_DrillingSystem", x => x.SystemId); table.PrimaryKey("PK_DataSourceSystem", x => x.SystemId);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -38,9 +38,9 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
{ {
table.PrimaryKey("PK_TechMessage", x => x.EventId); table.PrimaryKey("PK_TechMessage", x => x.EventId);
table.ForeignKey( table.ForeignKey(
name: "FK_TechMessage_DrillingSystem_SystemId", name: "FK_TechMessage_DataSourceSystem_SystemId",
column: x => x.SystemId, column: x => x.SystemId,
principalTable: "DrillingSystem", principalTable: "DataSourceSystem",
principalColumn: "SystemId", principalColumn: "SystemId",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
@ -58,7 +58,7 @@ namespace Persistence.Database.Postgres.Migrations.PersistencePostgres
name: "TechMessage"); name: "TechMessage");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "DrillingSystem"); name: "DataSourceSystem");
} }
} }
} }

View File

@ -24,25 +24,25 @@ namespace Persistence.Database.Postgres.Migrations
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Persistence.Database.Entity.DrillingSystem", b => modelBuilder.Entity("Persistence.Database.Entity.DataSourceSystem", b =>
{ {
b.Property<Guid>("SystemId") b.Property<Guid>("SystemId")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid") .HasColumnType("uuid")
.HasComment("Id системы автобурения"); .HasComment("Id системы - источника данных");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("text") .HasColumnType("text")
.HasComment("Описание системы автобурения"); .HasComment("Описание системы - источника данных");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("varchar(256)") .HasColumnType("varchar(256)")
.HasComment("Наименование системы автобурения"); .HasComment("Наименование системы - источника данных");
b.HasKey("SystemId"); b.HasKey("SystemId");
b.ToTable("DrillingSystem"); b.ToTable("DataSourceSystem");
}); });
modelBuilder.Entity("Persistence.Database.Entity.ParameterData", b => modelBuilder.Entity("Persistence.Database.Entity.ParameterData", b =>
@ -289,7 +289,7 @@ namespace Persistence.Database.Postgres.Migrations
modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b => modelBuilder.Entity("Persistence.Database.Entity.TechMessage", b =>
{ {
b.HasOne("Persistence.Database.Entity.DrillingSystem", "System") b.HasOne("Persistence.Database.Entity.DataSourceSystem", "System")
.WithMany() .WithMany()
.HasForeignKey("SystemId") .HasForeignKey("SystemId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)