SES-152 Add migration for Shopkeepers

This commit is contained in:
Karol Górzyński 2021-01-20 18:53:40 +01:00
parent 92fbe801b0
commit 561db899da
5 changed files with 59184 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace SessionCompanion.Database.Migrations
{
public partial class shopkepe : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Shopkeepers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsAvailable = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Shopkeepers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ShopkeeperItems",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ShopkeeperId = table.Column<int>(type: "int", nullable: false),
ArmorId = table.Column<int>(type: "int", nullable: true),
WeaponId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ShopkeeperItems", x => x.Id);
table.ForeignKey(
name: "FK_ShopkeeperItems_Armors_ArmorId",
column: x => x.ArmorId,
principalTable: "Armors",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ShopkeeperItems_Shopkeepers_ShopkeeperId",
column: x => x.ShopkeeperId,
principalTable: "Shopkeepers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ShopkeeperItems_Weapons_WeaponId",
column: x => x.WeaponId,
principalTable: "Weapons",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.InsertData(
table: "Shopkeepers",
columns: new[] { "Id", "IsAvailable", "Name" },
values: new object[,]
{
{ 1, true, "Swędzioch" },
{ 2, false, "Lucius Prawowity" },
{ 3, true, "Bohr Twarda Zbroja" },
{ 4, false, "Skwarczyk Podobny" },
{ 5, true, "Zielony spod Gruszkowego Lasu" },
{ 6, false, "Zmarniały" }
});
migrationBuilder.InsertData(
table: "ShopkeeperItems",
columns: new[] { "Id", "ArmorId", "ShopkeeperId", "WeaponId" },
values: new object[,]
{
{ 1, 2, 1, null },
{ 20, 13, 6, null },
{ 19, 2, 6, null },
{ 18, 7, 5, null },
{ 17, 9, 5, null },
{ 16, 6, 5, null },
{ 15, 11, 4, null },
{ 14, null, 4, 14 },
{ 13, null, 4, 24 },
{ 12, null, 4, 1 },
{ 11, null, 3, 7 },
{ 10, 8, 3, null },
{ 9, 1, 3, null },
{ 8, null, 2, 14 },
{ 7, null, 2, 25 },
{ 6, null, 2, 3 },
{ 5, 12, 1, null },
{ 4, null, 1, 17 },
{ 3, 10, 1, null },
{ 2, null, 1, 33 },
{ 21, 10, 6, null },
{ 22, null, 6, 37 }
});
migrationBuilder.CreateIndex(
name: "IX_ShopkeeperItems_ArmorId",
table: "ShopkeeperItems",
column: "ArmorId");
migrationBuilder.CreateIndex(
name: "IX_ShopkeeperItems_ShopkeeperId",
table: "ShopkeeperItems",
column: "ShopkeeperId");
migrationBuilder.CreateIndex(
name: "IX_ShopkeeperItems_WeaponId",
table: "ShopkeeperItems",
column: "WeaponId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ShopkeeperItems");
migrationBuilder.DropTable(
name: "Shopkeepers");
}
}
}

View File

@ -0,0 +1,178 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace SessionCompanion.Database.Migrations
{
public partial class shopkeepersitems : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Amount",
table: "ShopkeeperItems",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 1,
column: "Amount",
value: 3);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 2,
column: "Amount",
value: 5);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 3,
column: "Amount",
value: 20);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 4,
column: "Amount",
value: 34);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 5,
column: "Amount",
value: 12);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 6,
column: "Amount",
value: 48);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 7,
column: "Amount",
value: 25);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 8,
column: "Amount",
value: 34);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 9,
column: "Amount",
value: 44);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 10,
column: "Amount",
value: 2);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 11,
column: "Amount",
value: 21);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 12,
column: "Amount",
value: 36);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 13,
column: "Amount",
value: 5);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 14,
column: "Amount",
value: 13);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 15,
column: "Amount",
value: 19);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 16,
column: "Amount",
value: 17);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 17,
column: "Amount",
value: 3);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 18,
column: "Amount",
value: 1);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 19,
column: "Amount",
value: 6);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 20,
column: "Amount",
value: 9);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 21,
column: "Amount",
value: 12);
migrationBuilder.UpdateData(
table: "ShopkeeperItems",
keyColumn: "Id",
keyValue: 22,
column: "Amount",
value: 6);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Amount",
table: "ShopkeeperItems");
}
}
}

View File

@ -21521,6 +21521,248 @@ namespace SessionCompanion.Database.Migrations
}); });
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Shopkeeper", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<bool>("IsAvailable")
.HasColumnType("bit");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Shopkeepers");
b.HasData(
new
{
Id = 1,
IsAvailable = true,
Name = "Swędzioch"
},
new
{
Id = 2,
IsAvailable = false,
Name = "Lucius Prawowity"
},
new
{
Id = 3,
IsAvailable = true,
Name = "Bohr Twarda Zbroja"
},
new
{
Id = 4,
IsAvailable = false,
Name = "Skwarczyk Podobny"
},
new
{
Id = 5,
IsAvailable = true,
Name = "Zielony spod Gruszkowego Lasu"
},
new
{
Id = 6,
IsAvailable = false,
Name = "Zmarniały"
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.ShopkeeperItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("Amount")
.HasColumnType("int");
b.Property<int?>("ArmorId")
.HasColumnType("int");
b.Property<int>("ShopkeeperId")
.HasColumnType("int");
b.Property<int?>("WeaponId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ArmorId");
b.HasIndex("ShopkeeperId");
b.HasIndex("WeaponId");
b.ToTable("ShopkeeperItems");
b.HasData(
new
{
Id = 1,
Amount = 3,
ArmorId = 2,
ShopkeeperId = 1
},
new
{
Id = 2,
Amount = 5,
ShopkeeperId = 1,
WeaponId = 33
},
new
{
Id = 3,
Amount = 20,
ArmorId = 10,
ShopkeeperId = 1
},
new
{
Id = 4,
Amount = 34,
ShopkeeperId = 1,
WeaponId = 17
},
new
{
Id = 5,
Amount = 12,
ArmorId = 12,
ShopkeeperId = 1
},
new
{
Id = 6,
Amount = 48,
ShopkeeperId = 2,
WeaponId = 3
},
new
{
Id = 7,
Amount = 25,
ShopkeeperId = 2,
WeaponId = 25
},
new
{
Id = 8,
Amount = 34,
ShopkeeperId = 2,
WeaponId = 14
},
new
{
Id = 9,
Amount = 44,
ArmorId = 1,
ShopkeeperId = 3
},
new
{
Id = 10,
Amount = 2,
ArmorId = 8,
ShopkeeperId = 3
},
new
{
Id = 11,
Amount = 21,
ShopkeeperId = 3,
WeaponId = 7
},
new
{
Id = 12,
Amount = 36,
ShopkeeperId = 4,
WeaponId = 1
},
new
{
Id = 13,
Amount = 5,
ShopkeeperId = 4,
WeaponId = 24
},
new
{
Id = 14,
Amount = 13,
ShopkeeperId = 4,
WeaponId = 14
},
new
{
Id = 15,
Amount = 19,
ArmorId = 11,
ShopkeeperId = 4
},
new
{
Id = 16,
Amount = 17,
ArmorId = 6,
ShopkeeperId = 5
},
new
{
Id = 17,
Amount = 3,
ArmorId = 9,
ShopkeeperId = 5
},
new
{
Id = 18,
Amount = 1,
ArmorId = 7,
ShopkeeperId = 5
},
new
{
Id = 19,
Amount = 6,
ArmorId = 2,
ShopkeeperId = 6
},
new
{
Id = 20,
Amount = 9,
ArmorId = 13,
ShopkeeperId = 6
},
new
{
Id = 21,
Amount = 12,
ArmorId = 10,
ShopkeeperId = 6
},
new
{
Id = 22,
Amount = 6,
ShopkeeperId = 6,
WeaponId = 37
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b => modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -28921,6 +29163,29 @@ namespace SessionCompanion.Database.Migrations
b.Navigation("SpecialAbility"); b.Navigation("SpecialAbility");
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.ShopkeeperItem", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Armor", "Armor")
.WithMany()
.HasForeignKey("ArmorId");
b.HasOne("SessionCompanion.Database.Tables.Shopkeeper", "Shopkeeper")
.WithMany("ShopkeeperItems")
.HasForeignKey("ShopkeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SessionCompanion.Database.Tables.Weapon", "Weapon")
.WithMany()
.HasForeignKey("WeaponId");
b.Navigation("Armor");
b.Navigation("Shopkeeper");
b.Navigation("Weapon");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
{ {
b.HasOne("SessionCompanion.Database.Tables.Character", "Character") b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
@ -29022,6 +29287,11 @@ namespace SessionCompanion.Database.Migrations
b.Navigation("Biography"); b.Navigation("Biography");
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Shopkeeper", b =>
{
b.Navigation("ShopkeeperItems");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b => modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b =>
{ {
b.Navigation("MonsterSpecialAbilities"); b.Navigation("MonsterSpecialAbilities");