Skip to content

Instantly share code, notes, and snippets.

@MartinZikmund
Created January 21, 2019 16:33
Show Gist options
  • Save MartinZikmund/2a4e74fff9b788fe43bab3a453423498 to your computer and use it in GitHub Desktop.
Save MartinZikmund/2a4e74fff9b788fe43bab3a453423498 to your computer and use it in GitHub Desktop.
Invalid migration - this is not really what we wanted...
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Cows");
migrationBuilder.DropPrimaryKey(
name: "PK_Horses",
table: "Horses");
migrationBuilder.DropColumn(
name: "Id",
table: "Horses");
migrationBuilder.RenameTable(
name: "Horses",
newName: "Animal");
migrationBuilder.AlterColumn<int>(
name: "MaxJumpHeight",
table: "Animal",
nullable: true,
oldClrType: typeof(int));
migrationBuilder.AddColumn<int>(
name: "Number",
table: "Animal",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Year",
table: "Animal",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Discriminator",
table: "Animal",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<int>(
name: "Weight",
table: "Animal",
nullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_Animal",
table: "Animal",
columns: new[] { "Number", "Year" });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment