20170919035006_Initial.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using Microsoft.EntityFrameworkCore.Metadata;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Winsoft.GOV.XF.WebApi.WXCore.Migrations
  6. {
  7. public partial class Initial : Migration
  8. {
  9. protected override void Up(MigrationBuilder migrationBuilder)
  10. {
  11. migrationBuilder.CreateTable(
  12. name: "Bundle",
  13. columns: table => new
  14. {
  15. Id = table.Column<Guid>(type: "char(36)", nullable: false),
  16. Describe = table.Column<string>(type: "longtext", nullable: true)
  17. },
  18. constraints: table =>
  19. {
  20. table.PrimaryKey("PK_Bundle", x => x.Id);
  21. });
  22. migrationBuilder.CreateTable(
  23. name: "WXUser",
  24. columns: table => new
  25. {
  26. Id = table.Column<int>(type: "int", nullable: false)
  27. .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
  28. Mobile = table.Column<string>(type: "longtext", nullable: true),
  29. OpenId = table.Column<string>(type: "longtext", nullable: true)
  30. },
  31. constraints: table =>
  32. {
  33. table.PrimaryKey("PK_WXUser", x => x.Id);
  34. });
  35. migrationBuilder.CreateTable(
  36. name: "Asset",
  37. columns: table => new
  38. {
  39. Id = table.Column<Guid>(type: "char(36)", nullable: false),
  40. AssetType = table.Column<int>(type: "int", nullable: false),
  41. BundleId = table.Column<Guid>(type: "char(36)", nullable: false),
  42. Data = table.Column<string>(type: "longtext", nullable: true),
  43. Describe = table.Column<string>(type: "longtext", nullable: true)
  44. },
  45. constraints: table =>
  46. {
  47. table.PrimaryKey("PK_Asset", x => x.Id);
  48. table.ForeignKey(
  49. name: "FK_Asset_Bundle_BundleId",
  50. column: x => x.BundleId,
  51. principalTable: "Bundle",
  52. principalColumn: "Id",
  53. onDelete: ReferentialAction.Cascade);
  54. });
  55. migrationBuilder.CreateIndex(
  56. name: "IX_Asset_BundleId",
  57. table: "Asset",
  58. column: "BundleId");
  59. }
  60. protected override void Down(MigrationBuilder migrationBuilder)
  61. {
  62. migrationBuilder.DropTable(
  63. name: "Asset");
  64. migrationBuilder.DropTable(
  65. name: "WXUser");
  66. migrationBuilder.DropTable(
  67. name: "Bundle");
  68. }
  69. }
  70. }