using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using System; using System.Collections.Generic; namespace Winsoft.GOV.XF.WebApi.WXCore.Migrations { public partial class Initial : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Bundle", columns: table => new { Id = table.Column(type: "char(36)", nullable: false), Describe = table.Column(type: "longtext", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Bundle", x => x.Id); }); migrationBuilder.CreateTable( name: "WXUser", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Mobile = table.Column(type: "longtext", nullable: true), OpenId = table.Column(type: "longtext", nullable: true) }, constraints: table => { table.PrimaryKey("PK_WXUser", x => x.Id); }); migrationBuilder.CreateTable( name: "Asset", columns: table => new { Id = table.Column(type: "char(36)", nullable: false), AssetType = table.Column(type: "int", nullable: false), BundleId = table.Column(type: "char(36)", nullable: false), Data = table.Column(type: "longtext", nullable: true), Describe = table.Column(type: "longtext", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Asset", x => x.Id); table.ForeignKey( name: "FK_Asset_Bundle_BundleId", column: x => x.BundleId, principalTable: "Bundle", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Asset_BundleId", table: "Asset", column: "BundleId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Asset"); migrationBuilder.DropTable( name: "WXUser"); migrationBuilder.DropTable( name: "Bundle"); } } }