summaryrefslogtreecommitdiff
path: root/Migrations
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-06-03 07:41:46 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-06-03 07:41:46 +0300
commit3bade8859bcd938b85c39ab16eaa0dcf8e01535f (patch)
tree9157e3f27d8007206c12d5ec0cf5f2936295c0e7 /Migrations
parent81c1fc0c14253457c3c4fc24735e787ace1db70b (diff)
Mass refactoring
Diffstat (limited to 'Migrations')
-rw-r--r--Migrations/20230603040054_Initial.Designer.cs (renamed from Migrations/20230303041621_Init.Designer.cs)34
-rw-r--r--Migrations/20230603040054_Initial.cs (renamed from Migrations/20230303041621_Init.cs)30
-rw-r--r--Migrations/DataContextModelSnapshot.cs30
3 files changed, 42 insertions, 52 deletions
diff --git a/Migrations/20230303041621_Init.Designer.cs b/Migrations/20230603040054_Initial.Designer.cs
index 833e097..cf1a728 100644
--- a/Migrations/20230303041621_Init.Designer.cs
+++ b/Migrations/20230603040054_Initial.Designer.cs
@@ -1,5 +1,4 @@
// <auto-generated />
-using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
@@ -11,8 +10,8 @@ using MyDarling.Models;
namespace MyDarling.Migrations
{
[DbContext(typeof(DataContext))]
- [Migration("20230303041621_Init")]
- partial class Init
+ [Migration("20230603040054_Initial")]
+ partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -22,33 +21,28 @@ namespace MyDarling.Migrations
modelBuilder.Entity("MyDarling.Models.Figure", b =>
{
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property<string>("Id")
+ .HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
- b.Property<string>("FilePath")
+ b.Property<string>("ProductId")
.IsRequired()
.HasColumnType("TEXT");
- b.Property<int?>("UnderwearBundleId")
- .HasColumnType("INTEGER");
-
b.HasKey("Id");
- b.HasIndex("UnderwearBundleId");
+ b.HasIndex("ProductId");
b.ToTable("Figures");
});
- modelBuilder.Entity("MyDarling.Models.UnderwearBundle", b =>
+ modelBuilder.Entity("MyDarling.Models.Product", b =>
{
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property<string>("Id")
+ .HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
@@ -63,17 +57,19 @@ namespace MyDarling.Migrations
b.HasKey("Id");
- b.ToTable("UnderwearBundles");
+ b.ToTable("Products");
});
modelBuilder.Entity("MyDarling.Models.Figure", b =>
{
- b.HasOne("MyDarling.Models.UnderwearBundle", null)
+ b.HasOne("MyDarling.Models.Product", null)
.WithMany("Figures")
- .HasForeignKey("UnderwearBundleId");
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
- modelBuilder.Entity("MyDarling.Models.UnderwearBundle", b =>
+ modelBuilder.Entity("MyDarling.Models.Product", b =>
{
b.Navigation("Figures");
});
diff --git a/Migrations/20230303041621_Init.cs b/Migrations/20230603040054_Initial.cs
index 788d447..80b5601 100644
--- a/Migrations/20230303041621_Init.cs
+++ b/Migrations/20230603040054_Initial.cs
@@ -5,50 +5,48 @@
namespace MyDarling.Migrations
{
/// <inheritdoc />
- public partial class Init : Migration
+ public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
- name: "UnderwearBundles",
+ name: "Products",
columns: table => new
{
- Id = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
+ Id = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Price = table.Column<decimal>(type: "TEXT", nullable: false)
},
constraints: table =>
{
- table.PrimaryKey("PK_UnderwearBundles", x => x.Id);
+ table.PrimaryKey("PK_Products", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Figures",
columns: table => new
{
- Id = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
+ Id = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
- FilePath = table.Column<string>(type: "TEXT", nullable: false),
- UnderwearBundleId = table.Column<int>(type: "INTEGER", nullable: true)
+ ProductId = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Figures", x => x.Id);
table.ForeignKey(
- name: "FK_Figures_UnderwearBundles_UnderwearBundleId",
- column: x => x.UnderwearBundleId,
- principalTable: "UnderwearBundles",
- principalColumn: "Id");
+ name: "FK_Figures_Products_ProductId",
+ column: x => x.ProductId,
+ principalTable: "Products",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
- name: "IX_Figures_UnderwearBundleId",
+ name: "IX_Figures_ProductId",
table: "Figures",
- column: "UnderwearBundleId");
+ column: "ProductId");
}
/// <inheritdoc />
@@ -58,7 +56,7 @@ namespace MyDarling.Migrations
name: "Figures");
migrationBuilder.DropTable(
- name: "UnderwearBundles");
+ name: "Products");
}
}
}
diff --git a/Migrations/DataContextModelSnapshot.cs b/Migrations/DataContextModelSnapshot.cs
index b2177d7..6a8e605 100644
--- a/Migrations/DataContextModelSnapshot.cs
+++ b/Migrations/DataContextModelSnapshot.cs
@@ -1,5 +1,4 @@
// <auto-generated />
-using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -19,33 +18,28 @@ namespace MyDarling.Migrations
modelBuilder.Entity("MyDarling.Models.Figure", b =>
{
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property<string>("Id")
+ .HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
- b.Property<string>("FilePath")
+ b.Property<string>("ProductId")
.IsRequired()
.HasColumnType("TEXT");
- b.Property<int?>("UnderwearBundleId")
- .HasColumnType("INTEGER");
-
b.HasKey("Id");
- b.HasIndex("UnderwearBundleId");
+ b.HasIndex("ProductId");
b.ToTable("Figures");
});
- modelBuilder.Entity("MyDarling.Models.UnderwearBundle", b =>
+ modelBuilder.Entity("MyDarling.Models.Product", b =>
{
- b.Property<int>("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("INTEGER");
+ b.Property<string>("Id")
+ .HasColumnType("TEXT");
b.Property<string>("Description")
.IsRequired()
@@ -60,17 +54,19 @@ namespace MyDarling.Migrations
b.HasKey("Id");
- b.ToTable("UnderwearBundles");
+ b.ToTable("Products");
});
modelBuilder.Entity("MyDarling.Models.Figure", b =>
{
- b.HasOne("MyDarling.Models.UnderwearBundle", null)
+ b.HasOne("MyDarling.Models.Product", null)
.WithMany("Figures")
- .HasForeignKey("UnderwearBundleId");
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
- modelBuilder.Entity("MyDarling.Models.UnderwearBundle", b =>
+ modelBuilder.Entity("MyDarling.Models.Product", b =>
{
b.Navigation("Figures");
});