Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

丁松杰 / Pole

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • Pole
  • samples
  • apis
  • Backet.Api
  • Migrations
  • 20200218022312_Init.cs
Find file
BlameHistoryPermalink
  • 丁松杰's avatar
    添加 efcore grains 关系实体demo 及测试 · 91952c96
    丁松杰 committed 5 years ago
    91952c96
20200218022312_Init.cs 2.43 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
using Microsoft.EntityFrameworkCore.Migrations;

namespace Backet.Api.Migrations
{
    public partial class Init : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Backet",
                columns: table => new
                {
                    Id = table.Column<string>(maxLength: 32, nullable: false),
                    UserId = table.Column<string>(maxLength: 32, nullable: false),
                    TotalPrice = table.Column<long>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Backet", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BacketItem",
                columns: table => new
                {
                    Id = table.Column<string>(maxLength: 32, nullable: false),
                    ProductId = table.Column<string>(maxLength: 32, nullable: true),
                    ProductName = table.Column<string>(maxLength: 256, nullable: false),
                    Price = table.Column<long>(nullable: false),
                    BacketId = table.Column<string>(maxLength: 32, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BacketItem", x => x.Id);
                    table.ForeignKey(
                        name: "FK_BacketItem_Backet_BacketId",
                        column: x => x.BacketId,
                        principalTable: "Backet",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_Backet_UserId",
                table: "Backet",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_BacketItem_BacketId",
                table: "BacketItem",
                column: "BacketId");

            migrationBuilder.CreateIndex(
                name: "IX_BacketItem_ProductId",
                table: "BacketItem",
                column: "ProductId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "BacketItem");

            migrationBuilder.DropTable(
                name: "Backet");
        }
    }
}