51 lines
2.0 KiB
C#
51 lines
2.0 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace WebVentaCoche.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddAddressEntity : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Addresses",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Street = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
City = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
State = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
ZipCode = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
|
|
Country = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Addresses", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Addresses_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Addresses_UserId",
|
|
table: "Addresses",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Addresses");
|
|
}
|
|
}
|
|
}
|