Created
May 27, 2020 08:15
-
-
Save joewashington75/13e9d7d274ec12ec006965c09f8f7268 to your computer and use it in GitHub Desktop.
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
using System; | |
using Microsoft.EntityFrameworkCore.Migrations; | |
namespace EFCoreSeparateProject.Migrations.Migrations | |
{ | |
public partial class CustomerAddressAndOrders : Migration | |
{ | |
protected override void Up(MigrationBuilder migrationBuilder) | |
{ | |
migrationBuilder.CreateTable( | |
name: "CustomerOrders", | |
schema: "EfCore", | |
columns: table => new | |
{ | |
Id = table.Column<int>(nullable: false) | |
.Annotation("SqlServer:Identity", "1, 1"), | |
OrderDate = table.Column<DateTime>(nullable: false), | |
CustomerId = table.Column<int>(nullable: true) | |
}, | |
constraints: table => | |
{ | |
table.PrimaryKey("PK_CustomerOrders", x => x.Id); | |
table.ForeignKey( | |
name: "FK_CustomerOrders_Customers_CustomerId", | |
column: x => x.CustomerId, | |
principalSchema: "EfCore", | |
principalTable: "Customers", | |
principalColumn: "Id", | |
onDelete: ReferentialAction.Restrict); | |
}); | |
migrationBuilder.CreateIndex( | |
name: "IX_CustomerOrders_CustomerId", | |
schema: "EfCore", | |
table: "CustomerOrders", | |
column: "CustomerId"); | |
} | |
protected override void Down(MigrationBuilder migrationBuilder) | |
{ | |
migrationBuilder.DropTable( | |
name: "CustomerOrders", | |
schema: "EfCore"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment