41 lines
1.3 KiB
C#
Executable File
41 lines
1.3 KiB
C#
Executable File
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Api.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Products",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Products", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Products",
|
|
columns: new[] { "Id", "Name", "Price" },
|
|
values: new object[] { 1, "Sample Product", 9.99m });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Products");
|
|
}
|
|
}
|
|
}
|