-
-
Save christiannagel/2c474a47c701a9dc849bf8319df56db0 to your computer and use it in GitHub Desktop.
Initial migration of the Formula 1 database including seeding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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