Update migration
This commit is contained in:
parent
2ed258e3b8
commit
5b1e3e6d58
@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(AutoWorkshopDatabase))]
|
||||
[Migration("20240416160914_Implementers")]
|
||||
partial class Implementers
|
||||
[Migration("20240419194703_Mails")]
|
||||
partial class Mails
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -97,6 +97,36 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
b.ToTable("Implementers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.Property<string>("MessageId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("DateDelivery")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("SenderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -186,10 +216,17 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
b.ToTable("RepairComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.HasOne("AutoWorkshopDatabaseImplement.Models.Client", null)
|
||||
.WithMany("ClientMessages")
|
||||
.HasForeignKey("ClientId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("AutoWorkshopDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.WithMany("ClientOrders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -232,7 +269,9 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
b.Navigation("ClientMessages");
|
||||
|
||||
b.Navigation("ClientOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Component", b =>
|
@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Implementers : Migration
|
||||
public partial class Mails : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@ -71,6 +71,27 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
table.PrimaryKey("PK_Repairs", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Messages",
|
||||
columns: table => new
|
||||
{
|
||||
MessageId = table.Column<string>(type: "text", nullable: false),
|
||||
ClientId = table.Column<int>(type: "integer", nullable: true),
|
||||
SenderName = table.Column<string>(type: "text", nullable: false),
|
||||
DateDelivery = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
Subject = table.Column<string>(type: "text", nullable: false),
|
||||
Body = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Messages", x => x.MessageId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Messages_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
@ -135,6 +156,11 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Messages_ClientId",
|
||||
table: "Messages",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Orders_ClientId",
|
||||
table: "Orders",
|
||||
@ -164,6 +190,9 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Messages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Orders");
|
||||
|
@ -94,6 +94,36 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
b.ToTable("Implementers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.Property<string>("MessageId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Body")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("DateDelivery")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("SenderName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -183,10 +213,17 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
b.ToTable("RepairComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.MessageInfo", b =>
|
||||
{
|
||||
b.HasOne("AutoWorkshopDatabaseImplement.Models.Client", null)
|
||||
.WithMany("ClientMessages")
|
||||
.HasForeignKey("ClientId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("AutoWorkshopDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.WithMany("ClientOrders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -229,7 +266,9 @@ namespace AutoWorkshopDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
b.Navigation("ClientMessages");
|
||||
|
||||
b.Navigation("ClientOrders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoWorkshopDatabaseImplement.Models.Component", b =>
|
||||
|
Loading…
Reference in New Issue
Block a user