67 lines
2.6 KiB
C#
67 lines
2.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CompanyManagment.EFCore.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddRewardtocheckout : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<double>(
|
|
name: "RewardPay",
|
|
table: "Checkouts",
|
|
type: "float",
|
|
nullable: false,
|
|
defaultValue: 0.0,
|
|
oldClrType: typeof(double),
|
|
oldType: "float",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "CheckoutReward",
|
|
columns: table => new
|
|
{
|
|
Checkoutid = table.Column<long>(type: "bigint", nullable: false),
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Amount = table.Column<string>(type: "nvarchar(25)", maxLength: 25, nullable: true),
|
|
AmountDouble = table.Column<double>(type: "float", nullable: false),
|
|
GrantDateFa = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: true),
|
|
GrantDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Description = table.Column<string>(type: "ntext", nullable: true),
|
|
Title = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
|
EntityId = table.Column<long>(type: "bigint", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_CheckoutReward", x => new { x.Checkoutid, x.Id });
|
|
table.ForeignKey(
|
|
name: "FK_CheckoutReward_Checkouts_Checkoutid",
|
|
column: x => x.Checkoutid,
|
|
principalTable: "Checkouts",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "CheckoutReward");
|
|
|
|
migrationBuilder.AlterColumn<double>(
|
|
name: "RewardPay",
|
|
table: "Checkouts",
|
|
type: "float",
|
|
nullable: true,
|
|
oldClrType: typeof(double),
|
|
oldType: "float");
|
|
}
|
|
}
|
|
}
|