Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created August 28, 2018 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/2c474a47c701a9dc849bf8319df56db0 to your computer and use it in GitHub Desktop.
Save christiannagel/2c474a47c701a9dc849bf8319df56db0 to your computer and use it in GitHub Desktop.
Initial migration of the Formula 1 database including seeding
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Racers",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(maxLength: 100, nullable: false),
Team = table.Column<string>(maxLength: 60, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Racers", x => x.Id);
});
migrationBuilder.InsertData(
table: "Racers",
columns: new[] { "Id", "Name", "Team" },
values: new object[,]
{
{ 1, "Lewis Hamilton", "Mercedes" },
{ 2, "Sebastian Vettel", "Ferrari" },
{ 3, "Kimi Räikkönen", "Ferrari" },
{ 4, "Valtteri Bottas", "Mercedes" },
{ 5, "Max Verstappen", "Red Bull Racing" },
{ 6, "Daniel Ricciardo", "Red Bull Racing" }
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment