SES-104 Character Data Seed

This commit is contained in:
Łukasz Góreczny 2020-12-18 12:00:36 +01:00
parent c384b279cb
commit 6461af2757
5 changed files with 1385 additions and 0 deletions

View File

@ -31,6 +31,13 @@ namespace SessionCompanion.Database
{ {
base.OnModelCreating(builder); base.OnModelCreating(builder);
builder.Entity<User>().HasData(SeedData.SeedUsers()); builder.Entity<User>().HasData(SeedData.SeedUsers());
builder.Entity<Character>().HasData(SeedData.SeedCharacter());
builder.Entity<Race>().HasData(SeedData.SeedRace());
builder.Entity<Class>().HasData(SeedData.SeedClass());
builder.Entity<Alignment>().HasData(SeedData.SeedAlignment());
builder.Entity<Background>().HasData(SeedData.SeedBackground());
builder.Entity<Biography>().HasData(SeedData.SeedBiography());
builder.Entity<Statistics>().HasData(SeedData.SeedStatistics());
} }
} }
} }

View File

@ -0,0 +1,838 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SessionCompanion.Database;
namespace SessionCompanion.Database.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20201218105527_Character Data Seed")]
partial class CharacterDataSeed
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseIdentityColumns()
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.HasKey("Id");
b.ToTable("Alignments");
b.HasData(
new
{
Id = 1
},
new
{
Id = 2
},
new
{
Id = 3
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.HasKey("Id");
b.ToTable("Backgrounds");
b.HasData(
new
{
Id = 1
},
new
{
Id = 2
},
new
{
Id = 3
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("AlignmentId")
.HasColumnType("int");
b.Property<int>("BackgroundId")
.HasColumnType("int");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("ClassId")
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<int>("RaceId")
.HasColumnType("int");
b.Property<string>("Sex")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("AlignmentId");
b.HasIndex("BackgroundId");
b.HasIndex("CharacterId")
.IsUnique();
b.HasIndex("ClassId");
b.HasIndex("RaceId");
b.ToTable("Biographies");
b.HasData(
new
{
Id = 1,
AlignmentId = 1,
BackgroundId = 1,
CharacterId = 1,
ClassId = 1,
Name = "Bob",
RaceId = 1,
Sex = "Male"
},
new
{
Id = 2,
AlignmentId = 2,
BackgroundId = 2,
CharacterId = 2,
ClassId = 2,
Name = "Queen Daenerys Stormborn of the House Targaryen, the First of Her Name, Queen of the Andals, the Rhoynar and the First Men, Lady of the Seven Kingdoms and Protector of the Realm, Lady of Dragonstone, Queen of Meereen, Khaleesi of the Great Grass Sea, the Unburnt, Breaker of Chains and Mother of Dragons.",
RaceId = 2,
Sex = "Female"
},
new
{
Id = 3,
AlignmentId = 3,
BackgroundId = 3,
CharacterId = 3,
ClassId = 3,
Name = "Gandalf the White",
RaceId = 3,
Sex = "Both"
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Characters");
b.HasData(
new
{
Id = 1,
UserId = 1
},
new
{
Id = 2,
UserId = 2
},
new
{
Id = 3,
UserId = 3
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<bool>("CanDeception")
.HasColumnType("bit");
b.Property<bool>("CanIntimidation")
.HasColumnType("bit");
b.Property<bool>("CanPerformance")
.HasColumnType("bit");
b.Property<bool>("CanPersuasion")
.HasColumnType("bit");
b.Property<bool>("CanSaveThrows")
.HasColumnType("bit");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("Deception")
.HasColumnType("int");
b.Property<int>("Intimidation")
.HasColumnType("int");
b.Property<int>("Modification")
.HasColumnType("int");
b.Property<int>("Performance")
.HasColumnType("int");
b.Property<int>("Persuasion")
.HasColumnType("int");
b.Property<int>("SavingThrows")
.HasColumnType("int");
b.Property<int>("Value")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CharacterId")
.IsUnique();
b.ToTable("Charismas");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Classes");
b.HasData(
new
{
Id = 1,
Name = "Warrior"
},
new
{
Id = 2,
Name = "Knight"
},
new
{
Id = 3,
Name = "Priest"
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<bool>("CanSaveThrows")
.HasColumnType("bit");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("Modification")
.HasColumnType("int");
b.Property<int>("SavingThrows")
.HasColumnType("int");
b.Property<int>("Value")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CharacterId")
.IsUnique();
b.ToTable("Constitutions");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("Acrobatics")
.HasColumnType("int");
b.Property<bool>("CanAcrobatics")
.HasColumnType("bit");
b.Property<bool>("CanSaveThrows")
.HasColumnType("bit");
b.Property<bool>("CanSleightOfHand")
.HasColumnType("bit");
b.Property<bool>("CanStealth")
.HasColumnType("bit");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("Modification")
.HasColumnType("int");
b.Property<int>("SavingThrows")
.HasColumnType("int");
b.Property<int>("SleightOfHand")
.HasColumnType("int");
b.Property<int>("Stealth")
.HasColumnType("int");
b.Property<int>("Value")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CharacterId")
.IsUnique();
b.ToTable("Dexterities");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("Arcana")
.HasColumnType("int");
b.Property<bool>("CanArcana")
.HasColumnType("bit");
b.Property<bool>("CanHistory")
.HasColumnType("bit");
b.Property<bool>("CanInvestigation")
.HasColumnType("bit");
b.Property<bool>("CanNature")
.HasColumnType("bit");
b.Property<bool>("CanReligion")
.HasColumnType("bit");
b.Property<bool>("CanSaveThrows")
.HasColumnType("bit");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("History")
.HasColumnType("int");
b.Property<int>("Investigation")
.HasColumnType("int");
b.Property<int>("Modification")
.HasColumnType("int");
b.Property<int>("Nature")
.HasColumnType("int");
b.Property<int>("Religion")
.HasColumnType("int");
b.Property<int>("SavingThrows")
.HasColumnType("int");
b.Property<int>("Value")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CharacterId")
.IsUnique();
b.ToTable("Intelligences");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Races");
b.HasData(
new
{
Id = 1,
Name = "Human"
},
new
{
Id = 2,
Name = "Dwarf"
},
new
{
Id = 3,
Name = "Elf"
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("ArmorClass")
.HasColumnType("int");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("CurrentHealthPoints")
.HasColumnType("int");
b.Property<int>("ExperiencePoints")
.HasColumnType("int");
b.Property<int>("HealthPoints")
.HasColumnType("int");
b.Property<int>("Initiative")
.HasColumnType("int");
b.Property<int>("Level")
.HasColumnType("int");
b.Property<int>("Proficiency")
.HasColumnType("int");
b.Property<int>("Speed")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CharacterId")
.IsUnique();
b.ToTable("Statistics");
b.HasData(
new
{
Id = 1,
ArmorClass = 9,
CharacterId = 1,
CurrentHealthPoints = 18,
ExperiencePoints = 2,
HealthPoints = 20,
Initiative = 12,
Level = 1,
Proficiency = 1,
Speed = 5
},
new
{
Id = 2,
ArmorClass = 12,
CharacterId = 2,
CurrentHealthPoints = 26,
ExperiencePoints = 0,
HealthPoints = 26,
Initiative = 7,
Level = 1,
Proficiency = 1,
Speed = 10
},
new
{
Id = 3,
ArmorClass = 2,
CharacterId = 3,
CurrentHealthPoints = 7,
ExperiencePoints = 24,
HealthPoints = 7,
Initiative = 18,
Level = 1,
Proficiency = 2,
Speed = 15
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("Athletics")
.HasColumnType("int");
b.Property<bool>("CanAthletics")
.HasColumnType("bit");
b.Property<bool>("CanSaveThrows")
.HasColumnType("bit");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("Modification")
.HasColumnType("int");
b.Property<int>("SavingThrows")
.HasColumnType("int");
b.Property<int>("Value")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CharacterId")
.IsUnique();
b.ToTable("Strengths");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("Password")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
b.HasData(
new
{
Id = 1,
Password = "123",
Username = "Morwiec"
},
new
{
Id = 2,
Password = "123",
Username = "Cichoklepiec"
},
new
{
Id = 3,
Password = "123",
Username = "Ruletka"
});
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("AnimalHandling")
.HasColumnType("int");
b.Property<bool>("CanAnimalHandling")
.HasColumnType("bit");
b.Property<bool>("CanInsight")
.HasColumnType("bit");
b.Property<bool>("CanMedicine")
.HasColumnType("bit");
b.Property<bool>("CanPerception")
.HasColumnType("bit");
b.Property<bool>("CanSaveThrows")
.HasColumnType("bit");
b.Property<bool>("CanSurvival")
.HasColumnType("bit");
b.Property<int>("CharacterId")
.HasColumnType("int");
b.Property<int>("Insight")
.HasColumnType("int");
b.Property<int>("Medicine")
.HasColumnType("int");
b.Property<int>("Modification")
.HasColumnType("int");
b.Property<int>("Perception")
.HasColumnType("int");
b.Property<int>("SavingThrows")
.HasColumnType("int");
b.Property<int>("Survival")
.HasColumnType("int");
b.Property<int>("Value")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CharacterId")
.IsUnique();
b.ToTable("Wisdoms");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Alignment", "Alignment")
.WithMany("Biography")
.HasForeignKey("AlignmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SessionCompanion.Database.Tables.Background", "Background")
.WithMany("Biography")
.HasForeignKey("BackgroundId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Biography")
.HasForeignKey("SessionCompanion.Database.Tables.Biography", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SessionCompanion.Database.Tables.Class", "Class")
.WithMany("Biography")
.HasForeignKey("ClassId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SessionCompanion.Database.Tables.Race", "Race")
.WithMany("Biography")
.HasForeignKey("RaceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Alignment");
b.Navigation("Background");
b.Navigation("Character");
b.Navigation("Class");
b.Navigation("Race");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
{
b.HasOne("SessionCompanion.Database.Tables.User", "User")
.WithMany("Character")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Charisma")
.HasForeignKey("SessionCompanion.Database.Tables.Charisma", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Character");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Constitution")
.HasForeignKey("SessionCompanion.Database.Tables.Constitution", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Character");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Dexterity")
.HasForeignKey("SessionCompanion.Database.Tables.Dexterity", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Character");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Intelligence")
.HasForeignKey("SessionCompanion.Database.Tables.Intelligence", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Character");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Statistics")
.HasForeignKey("SessionCompanion.Database.Tables.Statistics", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Character");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Strength")
.HasForeignKey("SessionCompanion.Database.Tables.Strength", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Character");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b =>
{
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
.WithOne("Wisdom")
.HasForeignKey("SessionCompanion.Database.Tables.Wisdom", "CharacterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Character");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b =>
{
b.Navigation("Biography");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
{
b.Navigation("Biography");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
{
b.Navigation("Biography");
b.Navigation("Charisma");
b.Navigation("Constitution");
b.Navigation("Dexterity");
b.Navigation("Intelligence");
b.Navigation("Statistics");
b.Navigation("Strength");
b.Navigation("Wisdom");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b =>
{
b.Navigation("Biography");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b =>
{
b.Navigation("Biography");
});
modelBuilder.Entity("SessionCompanion.Database.Tables.User", b =>
{
b.Navigation("Character");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,188 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace SessionCompanion.Database.Migrations
{
public partial class CharacterDataSeed : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Alignments",
column: "Id",
values: new object[]
{
1,
2,
3
});
migrationBuilder.InsertData(
table: "Backgrounds",
column: "Id",
values: new object[]
{
1,
2,
3
});
migrationBuilder.InsertData(
table: "Characters",
columns: new[] { "Id", "UserId" },
values: new object[,]
{
{ 1, 1 },
{ 2, 2 },
{ 3, 3 }
});
migrationBuilder.InsertData(
table: "Classes",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 1, "Warrior" },
{ 2, "Knight" },
{ 3, "Priest" }
});
migrationBuilder.InsertData(
table: "Races",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 1, "Human" },
{ 2, "Dwarf" },
{ 3, "Elf" }
});
migrationBuilder.InsertData(
table: "Biographies",
columns: new[] { "Id", "AlignmentId", "BackgroundId", "CharacterId", "ClassId", "Name", "RaceId", "Sex" },
values: new object[,]
{
{ 1, 1, 1, 1, 1, "Bob", 1, "Male" },
{ 2, 2, 2, 2, 2, "Queen Daenerys Stormborn of the House Targaryen, the First of Her Name, Queen of the Andals, the Rhoynar and the First Men, Lady of the Seven Kingdoms and Protector of the Realm, Lady of Dragonstone, Queen of Meereen, Khaleesi of the Great Grass Sea, the Unburnt, Breaker of Chains and Mother of Dragons.", 2, "Female" },
{ 3, 3, 3, 3, 3, "Gandalf the White", 3, "Both" }
});
migrationBuilder.InsertData(
table: "Statistics",
columns: new[] { "Id", "ArmorClass", "CharacterId", "CurrentHealthPoints", "ExperiencePoints", "HealthPoints", "Initiative", "Level", "Proficiency", "Speed" },
values: new object[,]
{
{ 1, 9, 1, 18, 2, 20, 12, 1, 1, 5 },
{ 2, 12, 2, 26, 0, 26, 7, 1, 1, 10 },
{ 3, 2, 3, 7, 24, 7, 18, 1, 2, 15 }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Biographies",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Biographies",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Biographies",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Statistics",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Statistics",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Statistics",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Alignments",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Alignments",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Alignments",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Backgrounds",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Backgrounds",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Backgrounds",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Characters",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Characters",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Characters",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Classes",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Classes",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Classes",
keyColumn: "Id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "Races",
keyColumn: "Id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "Races",
keyColumn: "Id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "Races",
keyColumn: "Id",
keyValue: 3);
}
}
}

View File

@ -28,6 +28,20 @@ namespace SessionCompanion.Database.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Alignments"); b.ToTable("Alignments");
b.HasData(
new
{
Id = 1
},
new
{
Id = 2
},
new
{
Id = 3
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b =>
@ -40,6 +54,20 @@ namespace SessionCompanion.Database.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Backgrounds"); b.ToTable("Backgrounds");
b.HasData(
new
{
Id = 1
},
new
{
Id = 2
},
new
{
Id = 3
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b =>
@ -84,6 +112,41 @@ namespace SessionCompanion.Database.Migrations
b.HasIndex("RaceId"); b.HasIndex("RaceId");
b.ToTable("Biographies"); b.ToTable("Biographies");
b.HasData(
new
{
Id = 1,
AlignmentId = 1,
BackgroundId = 1,
CharacterId = 1,
ClassId = 1,
Name = "Bob",
RaceId = 1,
Sex = "Male"
},
new
{
Id = 2,
AlignmentId = 2,
BackgroundId = 2,
CharacterId = 2,
ClassId = 2,
Name = "Queen Daenerys Stormborn of the House Targaryen, the First of Her Name, Queen of the Andals, the Rhoynar and the First Men, Lady of the Seven Kingdoms and Protector of the Realm, Lady of Dragonstone, Queen of Meereen, Khaleesi of the Great Grass Sea, the Unburnt, Breaker of Chains and Mother of Dragons.",
RaceId = 2,
Sex = "Female"
},
new
{
Id = 3,
AlignmentId = 3,
BackgroundId = 3,
CharacterId = 3,
ClassId = 3,
Name = "Gandalf the White",
RaceId = 3,
Sex = "Both"
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b =>
@ -101,6 +164,23 @@ namespace SessionCompanion.Database.Migrations
b.HasIndex("UserId"); b.HasIndex("UserId");
b.ToTable("Characters"); b.ToTable("Characters");
b.HasData(
new
{
Id = 1,
UserId = 1
},
new
{
Id = 2,
UserId = 2
},
new
{
Id = 3,
UserId = 3
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b =>
@ -170,6 +250,23 @@ namespace SessionCompanion.Database.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Classes"); b.ToTable("Classes");
b.HasData(
new
{
Id = 1,
Name = "Warrior"
},
new
{
Id = 2,
Name = "Knight"
},
new
{
Id = 3,
Name = "Priest"
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b =>
@ -323,6 +420,23 @@ namespace SessionCompanion.Database.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Races"); b.ToTable("Races");
b.HasData(
new
{
Id = 1,
Name = "Human"
},
new
{
Id = 2,
Name = "Dwarf"
},
new
{
Id = 3,
Name = "Elf"
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
@ -365,6 +479,47 @@ namespace SessionCompanion.Database.Migrations
.IsUnique(); .IsUnique();
b.ToTable("Statistics"); b.ToTable("Statistics");
b.HasData(
new
{
Id = 1,
ArmorClass = 9,
CharacterId = 1,
CurrentHealthPoints = 18,
ExperiencePoints = 2,
HealthPoints = 20,
Initiative = 12,
Level = 1,
Proficiency = 1,
Speed = 5
},
new
{
Id = 2,
ArmorClass = 12,
CharacterId = 2,
CurrentHealthPoints = 26,
ExperiencePoints = 0,
HealthPoints = 26,
Initiative = 7,
Level = 1,
Proficiency = 1,
Speed = 10
},
new
{
Id = 3,
ArmorClass = 2,
CharacterId = 3,
CurrentHealthPoints = 7,
ExperiencePoints = 24,
HealthPoints = 7,
Initiative = 18,
Level = 1,
Proficiency = 2,
Speed = 15
});
}); });
modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b => modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b =>

View File

@ -35,5 +35,202 @@ namespace SessionCompanion.Database
}; };
return users; return users;
} }
static public List<Character> SeedCharacter()
{
List<Character> characters = new List<Character>
{
new Character
{
Id = 1,
UserId = 1,
},
new Character
{
Id = 2,
UserId = 2,
},
new Character
{
Id = 3,
UserId = 3,
}
};
return characters;
}
static public List<Class> SeedClass()
{
List<Class> classes = new List<Class>
{
new Class
{
Id = 1,
Name = "Warrior"
},
new Class
{
Id = 2,
Name = "Knight"
},
new Class
{
Id = 3,
Name = "Priest"
}
};
return classes;
}
static public List<Race> SeedRace()
{
List<Race> races = new List<Race>
{
new Race
{
Id = 1,
Name = "Human"
},
new Race
{
Id = 2,
Name = "Dwarf"
},
new Race
{
Id = 3,
Name = "Elf"
}
};
return races;
}
static public List<Alignment> SeedAlignment()
{
List<Alignment> alignments = new List<Alignment>
{
new Alignment
{
Id = 1,
},
new Alignment
{
Id = 2,
},
new Alignment
{
Id = 3,
}
};
return alignments;
}
static public List<Background> SeedBackground()
{
List<Background> backgrounds = new List<Background>
{
new Background
{
Id = 1,
},
new Background
{
Id = 2,
},
new Background
{
Id = 3,
}
};
return backgrounds;
}
static public List<Biography> SeedBiography()
{
List<Biography> bios = new List<Biography>
{
new Biography
{
Id = 1,
Sex = "Male",
CharacterId = 1,
ClassId = 1,
AlignmentId = 1,
BackgroundId = 1,
RaceId = 1,
Name = "Bob"
},
new Biography
{
Id = 2,
Sex = "Female",
CharacterId = 2,
ClassId = 2,
AlignmentId = 2,
BackgroundId = 2,
RaceId = 2,
Name = "Queen Daenerys Stormborn of the House Targaryen, the First of Her Name, Queen of the Andals, the Rhoynar and the First Men, Lady of the Seven Kingdoms and Protector of the Realm, Lady of Dragonstone, Queen of Meereen, Khaleesi of the Great Grass Sea, the Unburnt, Breaker of Chains and Mother of Dragons."
},
new Biography
{
Id = 3,
Sex = "Both",
CharacterId = 3,
ClassId = 3,
AlignmentId = 3,
BackgroundId = 3,
RaceId = 3,
Name = "Gandalf the White"
}
};
return bios;
}
static public List<Statistics> SeedStatistics()
{
List<Statistics> characters = new List<Statistics>
{
new Statistics
{
Id = 1,
CharacterId = 1,
ArmorClass = 9,
ExperiencePoints = 2,
Level = 1,
Speed = 5,
Initiative = 12,
HealthPoints = 20,
CurrentHealthPoints = 18,
Proficiency = 1
},
new Statistics
{
Id = 2,
CharacterId = 2,
ArmorClass = 12,
ExperiencePoints = 0,
Level = 1,
Speed = 10,
Initiative = 7,
HealthPoints = 26,
CurrentHealthPoints = 26,
Proficiency = 1
},
new Statistics
{
Id = 3,
CharacterId = 3,
ArmorClass = 2,
ExperiencePoints = 24,
Level = 1,
Speed = 15,
Initiative = 18,
HealthPoints = 7,
CurrentHealthPoints = 7,
Proficiency = 2
}
};
return characters;
}
} }
} }