Опять дропнулмиграцию и сделал заново
This commit is contained in:
parent
2eb0d882ca
commit
8292e1a4ae
@ -12,7 +12,7 @@ using SchoolDatabaseImplement;
|
||||
namespace SchoolDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(SchoolDatabase))]
|
||||
[Migration("20240501191433_InitialCreate")]
|
||||
[Migration("20240502154944_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -54,6 +54,46 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
b.ToTable("Achievements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Club", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clubs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.ClubLesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClubId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClubId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("ClubLessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Interest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -122,7 +162,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("MaterialId");
|
||||
|
||||
b.ToTable("InterestMaterial");
|
||||
b.ToTable("InterestMaterials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Lesson", b =>
|
||||
@ -163,7 +203,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Material");
|
||||
b.ToTable("Materials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.User", b =>
|
||||
@ -209,6 +249,25 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.ClubLesson", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabaseImplement.Models.Club", "Club")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("ClubId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SchoolDatabaseImplement.Models.Lesson", "Lesson")
|
||||
.WithMany()
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Club");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.InterestLesson", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabaseImplement.Models.Interest", "Interest")
|
||||
@ -258,6 +317,11 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Club", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Interest", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
@ -11,6 +11,19 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Clubs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Clubs", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Interests",
|
||||
columns: table => new
|
||||
@ -27,7 +40,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Material",
|
||||
name: "Materials",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
@ -36,7 +49,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Material", x => x.Id);
|
||||
table.PrimaryKey("PK_Materials", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -57,7 +70,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InterestMaterial",
|
||||
name: "InterestMaterials",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
@ -67,17 +80,17 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InterestMaterial", x => x.Id);
|
||||
table.PrimaryKey("PK_InterestMaterials", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_InterestMaterial_Interests_InterestId",
|
||||
name: "FK_InterestMaterials_Interests_InterestId",
|
||||
column: x => x.InterestId,
|
||||
principalTable: "Interests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InterestMaterial_Material_MaterialId",
|
||||
name: "FK_InterestMaterials_Materials_MaterialId",
|
||||
column: x => x.MaterialId,
|
||||
principalTable: "Material",
|
||||
principalTable: "Materials",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -125,6 +138,32 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ClubLessons",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClubId = table.Column<int>(type: "int", nullable: false),
|
||||
LessonId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ClubLessons", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ClubLessons_Clubs_ClubId",
|
||||
column: x => x.ClubId,
|
||||
principalTable: "Clubs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ClubLessons_Lessons_LessonId",
|
||||
column: x => x.LessonId,
|
||||
principalTable: "Lessons",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InterestLessons",
|
||||
columns: table => new
|
||||
@ -156,6 +195,16 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
table: "Achievements",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ClubLessons_ClubId",
|
||||
table: "ClubLessons",
|
||||
column: "ClubId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ClubLessons_LessonId",
|
||||
table: "ClubLessons",
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InterestLessons_InterestId",
|
||||
table: "InterestLessons",
|
||||
@ -167,13 +216,13 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
column: "LessonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InterestMaterial_InterestId",
|
||||
table: "InterestMaterial",
|
||||
name: "IX_InterestMaterials_InterestId",
|
||||
table: "InterestMaterials",
|
||||
column: "InterestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InterestMaterial_MaterialId",
|
||||
table: "InterestMaterial",
|
||||
name: "IX_InterestMaterials_MaterialId",
|
||||
table: "InterestMaterials",
|
||||
column: "MaterialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
@ -188,11 +237,17 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "Achievements");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ClubLessons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InterestLessons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InterestMaterial");
|
||||
name: "InterestMaterials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clubs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Lessons");
|
||||
@ -201,7 +256,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
name: "Interests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Material");
|
||||
name: "Materials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
@ -51,6 +51,46 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
b.ToTable("Achievements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Club", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clubs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.ClubLesson", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClubId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LessonId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClubId");
|
||||
|
||||
b.HasIndex("LessonId");
|
||||
|
||||
b.ToTable("ClubLessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Interest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -119,7 +159,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("MaterialId");
|
||||
|
||||
b.ToTable("InterestMaterial");
|
||||
b.ToTable("InterestMaterials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Lesson", b =>
|
||||
@ -160,7 +200,7 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Material");
|
||||
b.ToTable("Materials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.User", b =>
|
||||
@ -206,6 +246,25 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.ClubLesson", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabaseImplement.Models.Club", "Club")
|
||||
.WithMany("Lessons")
|
||||
.HasForeignKey("ClubId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("SchoolDatabaseImplement.Models.Lesson", "Lesson")
|
||||
.WithMany()
|
||||
.HasForeignKey("LessonId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Club");
|
||||
|
||||
b.Navigation("Lesson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.InterestLesson", b =>
|
||||
{
|
||||
b.HasOne("SchoolDatabaseImplement.Models.Interest", "Interest")
|
||||
@ -255,6 +314,11 @@ namespace SchoolDatabaseImplement.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Club", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SchoolDatabaseImplement.Models.Interest", b =>
|
||||
{
|
||||
b.Navigation("Lessons");
|
||||
|
@ -25,6 +25,11 @@ namespace SchoolDatabaseImplement
|
||||
public virtual DbSet<InterestLesson> InterestLessons { set; get; }
|
||||
public virtual DbSet<Interest> Interests { set; get; }
|
||||
public virtual DbSet<Achievement> Achievements { set; get; }
|
||||
public virtual DbSet<Club> Clubs { set; get; }
|
||||
public virtual DbSet<ClubLesson> ClubLessons { set; get; }
|
||||
public virtual DbSet<Material> Materials { set; get; }
|
||||
|
||||
public virtual DbSet<InterestMaterial> InterestMaterials { set; get; }
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user