using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace WCS.Service.Migrations { public partial class _1 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "WCS_AGVTask", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), AGVID = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), TaskType = table.Column(type: "int", nullable: false), Status = table.Column(type: "int", nullable: false), AGVStatus = table.Column(type: "int", nullable: false), Workshop = table.Column(type: "int", nullable: false), Station = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), Position = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), CreateTime = table.Column(type: "datetime2", nullable: false), UpdateTime = table.Column(type: "datetime2", nullable: true), AGVUpdateTime = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_AGVTask", x => x.ID); }); migrationBuilder.CreateTable( name: "WCS_CMD", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DEVICE_CODE = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), PROTOCOL = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), PROPERTY = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), VALUE = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), WCSVERSION = table.Column(type: "int", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_CMD", x => x.ID); }); migrationBuilder.CreateTable( name: "WCS_DEVICE", columns: table => new { CODE = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), NAME = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_DEVICE", x => x.CODE); }); migrationBuilder.CreateTable( name: "WCS_EXCEPTION", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MSG = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), STARTTIME = table.Column(type: "datetime2", nullable: false), TIMES = table.Column(type: "int", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_EXCEPTION", x => x.ID); }); migrationBuilder.CreateTable( name: "WCS_MAPPINGENTRY", columns: table => new { MEP_ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), MEP_MAPPINGNO = table.Column(type: "int", nullable: false), MEP_MAPPINGTYPE = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), MEP_MAPPINGCHNAME = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), MEP_ISSTOP = table.Column(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_MAPPINGENTRY", x => x.MEP_ID); }); migrationBuilder.CreateTable( name: "WCS_PLC", columns: table => new { CODE = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), NAME = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), IP = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), PORT = table.Column(type: "int", nullable: false), SLOT = table.Column(type: "int", nullable: false), RACK = table.Column(type: "int", nullable: false), TYPE = table.Column(type: "int", nullable: false), MODEL = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_PLC", x => x.CODE); }); migrationBuilder.CreateTable( name: "WCS_StatusLog", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), WCS_TASKID = table.Column(type: "int", nullable: false), NewStatus = table.Column(type: "int", nullable: false), OldStatus = table.Column(type: "int", nullable: false), upStatus = table.Column(type: "int", nullable: false), Node = table.Column(type: "nvarchar(max)", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_StatusLog", x => x.ID); }); migrationBuilder.CreateTable( name: "WCS_SystemConfig", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Code = table.Column(type: "nvarchar(max)", nullable: false), Describe = table.Column(type: "nvarchar(max)", nullable: false), DEVICECODE = table.Column(type: "nvarchar(max)", nullable: false), TUNNEL = table.Column(type: "nvarchar(max)", nullable: false), Direction = table.Column(type: "nvarchar(max)", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_SystemConfig", x => x.ID); }); migrationBuilder.CreateTable( name: "WCS_TASK", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), BARCODE = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), TYPE = table.Column(type: "int", nullable: false), STATUS = table.Column(type: "int", nullable: false), ADDRFROM = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), ADDRTO = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), ADDRNEXT = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), TUNNEL = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false), FLOOR = table.Column(type: "int", nullable: false), DEVICE = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), SCSTATION = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), CREATETIME = table.Column(type: "datetime2", nullable: false), STARTTIME = table.Column(type: "datetime2", nullable: true), ENDTIME = table.Column(type: "datetime2", nullable: true), DOCID = table.Column(type: "int", nullable: false), PALLETTYPE = table.Column(type: "smallint", nullable: false), PRODLINE = table.Column(type: "smallint", nullable: false), FULLQTY = table.Column(type: "smallint", nullable: false), HEIGHT = table.Column(type: "smallint", nullable: false), WMSTASK = table.Column(type: "int", nullable: false), TaskGroupKey = table.Column(type: "nvarchar(max)", nullable: false), UPLOADED = table.Column(type: "int", nullable: false), AgvTask = table.Column(type: "int", nullable: false), Priority = table.Column(type: "int", nullable: false), ManualRemarks = table.Column(type: "nvarchar(max)", nullable: true), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_TASK", x => x.ID); }); migrationBuilder.CreateTable( name: "WCS_Users", columns: table => new { USER_NO = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), USER_PWD = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), USER_TEXT = table.Column(type: "varbinary(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_Users", x => x.USER_NO); }); migrationBuilder.CreateTable( name: "WCS_BCR80", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Content = table.Column(type: "nvarchar(130)", maxLength: 130, nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: true), FRAME = table.Column(type: "datetime2", nullable: false), ISLAST = table.Column(type: "bit", nullable: false), WCSVERSION = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_BCR80", x => x.ID); table.ForeignKey( name: "FK_WCS_BCR80_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); }); migrationBuilder.CreateTable( name: "WCS_PATH", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), STARTCODE = table.Column(type: "nvarchar(50)", nullable: false), ENDCODE = table.Column(type: "nvarchar(50)", nullable: false), PATH = table.Column(type: "nvarchar(max)", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_PATH", x => x.ID); table.ForeignKey( name: "FK_WCS_PATH_WCS_DEVICE_ENDCODE", column: x => x.ENDCODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WCS_PATH_WCS_DEVICE_STARTCODE", column: x => x.STARTCODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "WCS_PATHPOINT", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), STARTCODE = table.Column(type: "nvarchar(50)", nullable: false), ENDCODE = table.Column(type: "nvarchar(50)", nullable: false), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: false), PREVCODE = table.Column(type: "nvarchar(50)", nullable: true), NEXTCODE = table.Column(type: "nvarchar(50)", nullable: true), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_PATHPOINT", x => x.ID); table.ForeignKey( name: "FK_WCS_PATHPOINT_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WCS_PATHPOINT_WCS_DEVICE_ENDCODE", column: x => x.ENDCODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WCS_PATHPOINT_WCS_DEVICE_NEXTCODE", column: x => x.NEXTCODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); table.ForeignKey( name: "FK_WCS_PATHPOINT_WCS_DEVICE_PREVCODE", column: x => x.PREVCODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); table.ForeignKey( name: "FK_WCS_PATHPOINT_WCS_DEVICE_STARTCODE", column: x => x.STARTCODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "WCS_RGV520", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TaskID_1 = table.Column(type: "int", nullable: false), TaskType_1 = table.Column(type: "smallint", nullable: false), StartPosition_1 = table.Column(type: "smallint", nullable: false), DestPosition_1 = table.Column(type: "smallint", nullable: false), Priority_1 = table.Column(type: "smallint", nullable: false), RES1_1 = table.Column(type: "smallint", nullable: false), RES2_1 = table.Column(type: "smallint", nullable: false), Trigger_1 = table.Column(type: "int", nullable: false), TaskID_2 = table.Column(type: "int", nullable: false), TaskType_2 = table.Column(type: "smallint", nullable: false), StartPosition_2 = table.Column(type: "smallint", nullable: false), DestPosition_2 = table.Column(type: "smallint", nullable: false), Priority_2 = table.Column(type: "smallint", nullable: false), RES1_2 = table.Column(type: "smallint", nullable: false), RES2_2 = table.Column(type: "smallint", nullable: false), Trigger_2 = table.Column(type: "int", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: true), FRAME = table.Column(type: "datetime2", nullable: false), ISLAST = table.Column(type: "bit", nullable: false), WCSVERSION = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_RGV520", x => x.ID); table.ForeignKey( name: "FK_WCS_RGV520_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); }); migrationBuilder.CreateTable( name: "WCS_RGV521", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), TaskID_1 = table.Column(type: "int", nullable: false), TaskType_1 = table.Column(type: "smallint", nullable: false), StartPosition_1 = table.Column(type: "smallint", nullable: false), DestPosition_1 = table.Column(type: "smallint", nullable: false), PRIORITY_1 = table.Column(type: "smallint", nullable: false), RES1_1 = table.Column(type: "smallint", nullable: false), RES2_1 = table.Column(type: "smallint", nullable: false), PH_Status_1 = table.Column(type: "bit", nullable: false), ToSition_1 = table.Column(type: "bit", nullable: false), Finish_1 = table.Column(type: "bit", nullable: false), RES3_1 = table.Column(type: "bit", nullable: false), RES4_1 = table.Column(type: "bit", nullable: false), RES5_1 = table.Column(type: "bit", nullable: false), RES6_1 = table.Column(type: "bit", nullable: false), RES7_1 = table.Column(type: "bit", nullable: false), Trigger_1 = table.Column(type: "int", nullable: false), TaskID_2 = table.Column(type: "int", nullable: false), TaskType_2 = table.Column(type: "smallint", nullable: false), StartPosition_2 = table.Column(type: "smallint", nullable: false), DestPosition_2 = table.Column(type: "smallint", nullable: false), PRIORITY_2 = table.Column(type: "smallint", nullable: false), RES1_2 = table.Column(type: "smallint", nullable: false), RES2_2 = table.Column(type: "smallint", nullable: false), PH_Status_2 = table.Column(type: "bit", nullable: false), ToSition_2 = table.Column(type: "bit", nullable: false), Finish_2 = table.Column(type: "bit", nullable: false), RES3_2 = table.Column(type: "bit", nullable: false), RES4_2 = table.Column(type: "bit", nullable: false), RES5_2 = table.Column(type: "bit", nullable: false), RES6_2 = table.Column(type: "bit", nullable: false), RES7_2 = table.Column(type: "bit", nullable: false), Trigger_2 = table.Column(type: "int", nullable: false), SystemStatus = table.Column(type: "smallint", nullable: false), WorkMode = table.Column(type: "smallint", nullable: false), Position = table.Column(type: "real", nullable: false), Mileage = table.Column(type: "real", nullable: false), Runtime = table.Column(type: "real", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: true), FRAME = table.Column(type: "datetime2", nullable: false), ISLAST = table.Column(type: "bit", nullable: false), WCSVERSION = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_RGV521", x => x.ID); table.ForeignKey( name: "FK_WCS_RGV521_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); }); migrationBuilder.CreateTable( name: "WCS_RGV523", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Fault = table.Column(type: "int", nullable: false), Fault1 = table.Column(type: "int", nullable: false), Fault2 = table.Column(type: "int", nullable: false), Status = table.Column(type: "int", nullable: false), Status1 = table.Column(type: "int", nullable: false), Status2 = table.Column(type: "int", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: true), FRAME = table.Column(type: "datetime2", nullable: false), ISLAST = table.Column(type: "bit", nullable: false), WCSVERSION = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_RGV523", x => x.ID); table.ForeignKey( name: "FK_WCS_RGV523_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); }); migrationBuilder.CreateTable( name: "WCS_ROUTE", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: false), NEXTCODE = table.Column(type: "nvarchar(50)", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_ROUTE", x => x.ID); table.ForeignKey( name: "FK_WCS_ROUTE_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WCS_ROUTE_WCS_DEVICE_NEXTCODE", column: x => x.NEXTCODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "WCS_STATION50", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), S_TaskId = table.Column(type: "int", nullable: false), S_GoodsCode = table.Column(type: "int", nullable: false), S_GoodsType = table.Column(type: "smallint", nullable: false), S_GoodsSize = table.Column(type: "smallint", nullable: false), S_GoodsStart = table.Column(type: "smallint", nullable: false), S_GoodsEnd = table.Column(type: "smallint", nullable: false), S_Height = table.Column(type: "smallint", nullable: false), G_TaskId = table.Column(type: "int", nullable: false), G_GoodsStart = table.Column(type: "smallint", nullable: false), G_GoodsEnd = table.Column(type: "smallint", nullable: false), G_GoodsCode = table.Column(type: "int", nullable: false), G_GoodsType = table.Column(type: "smallint", nullable: false), G_GoodsSize = table.Column(type: "smallint", nullable: false), G_Height = table.Column(type: "smallint", nullable: false), S_Confirm = table.Column(type: "bit", nullable: false), G_Station_Ready = table.Column(type: "bit", nullable: false), S_TaskDelete = table.Column(type: "bit", nullable: false), G_Notask = table.Column(type: "bit", nullable: false), G_PhStatus = table.Column(type: "bit", nullable: false), G_Request = table.Column(type: "bit", nullable: false), G_GoodsError = table.Column(type: "bit", nullable: false), G_F_Outside = table.Column(type: "bit", nullable: false), G_B_Outside = table.Column(type: "bit", nullable: false), G_L_Outside = table.Column(type: "bit", nullable: false), G_R_Outside = table.Column(type: "bit", nullable: false), G_H_Outside = table.Column(type: "bit", nullable: false), G_BCR_NoRead = table.Column(type: "bit", nullable: false), G_Overload = table.Column(type: "bit", nullable: false), S_AGV_Put_OK = table.Column(type: "bit", nullable: false), S_AGV_Get_OK = table.Column(type: "bit", nullable: false), G_Weight = table.Column(type: "smallint", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: true), FRAME = table.Column(type: "datetime2", nullable: false), ISLAST = table.Column(type: "bit", nullable: false), WCSVERSION = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_STATION50", x => x.ID); table.ForeignKey( name: "FK_WCS_STATION50_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); }); migrationBuilder.CreateTable( name: "WCS_STATION70", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Alarm = table.Column(type: "int", nullable: false), RES = table.Column(type: "smallint", nullable: false), Status = table.Column(type: "int", nullable: false), RunTime = table.Column(type: "real", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: true), FRAME = table.Column(type: "datetime2", nullable: false), ISLAST = table.Column(type: "bit", nullable: false), WCSVERSION = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_WCS_STATION70", x => x.ID); table.ForeignKey( name: "FK_WCS_STATION70_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE"); }); migrationBuilder.CreateTable( name: "WCS_DATABLOCK", columns: table => new { CODE = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), NAME = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), PLCCODE = table.Column(type: "nvarchar(20)", nullable: true), NO = table.Column(type: "int", nullable: false), LENGTH = table.Column(type: "int", nullable: false), DATALENGTH = table.Column(type: "int", nullable: false), PROTOCOL = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), NOUPDATE = table.Column(type: "bit", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_DATABLOCK", x => x.CODE); table.ForeignKey( name: "FK_WCS_DATABLOCK_WCS_PLC_PLCCODE", column: x => x.PLCCODE, principalTable: "WCS_PLC", principalColumn: "CODE"); }); migrationBuilder.CreateTable( name: "WCS_DEVICEPROTOCOL", columns: table => new { ID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), DEVICECODE = table.Column(type: "nvarchar(50)", nullable: false), DBCODE = table.Column(type: "nvarchar(20)", nullable: false), POSITION = table.Column(type: "smallint", nullable: false), ENABLED = table.Column(type: "bit", nullable: false), UPDATEUSER = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), UPDATETIME = table.Column(type: "datetime2", nullable: false), VER = table.Column(type: "rowversion", rowVersion: true, nullable: true) }, constraints: table => { table.PrimaryKey("PK_WCS_DEVICEPROTOCOL", x => x.ID); table.ForeignKey( name: "FK_WCS_DEVICEPROTOCOL_WCS_DATABLOCK_DBCODE", column: x => x.DBCODE, principalTable: "WCS_DATABLOCK", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_WCS_DEVICEPROTOCOL_WCS_DEVICE_DEVICECODE", column: x => x.DEVICECODE, principalTable: "WCS_DEVICE", principalColumn: "CODE", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_WCS_BCR80_DEVICECODE", table: "WCS_BCR80", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_DATABLOCK_PLCCODE", table: "WCS_DATABLOCK", column: "PLCCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_DEVICEPROTOCOL_DBCODE", table: "WCS_DEVICEPROTOCOL", column: "DBCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_DEVICEPROTOCOL_DEVICECODE", table: "WCS_DEVICEPROTOCOL", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_PATH_ENDCODE", table: "WCS_PATH", column: "ENDCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_PATH_STARTCODE", table: "WCS_PATH", column: "STARTCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_PATHPOINT_DEVICECODE", table: "WCS_PATHPOINT", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_PATHPOINT_ENDCODE", table: "WCS_PATHPOINT", column: "ENDCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_PATHPOINT_NEXTCODE", table: "WCS_PATHPOINT", column: "NEXTCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_PATHPOINT_PREVCODE", table: "WCS_PATHPOINT", column: "PREVCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_PATHPOINT_STARTCODE", table: "WCS_PATHPOINT", column: "STARTCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_RGV520_DEVICECODE", table: "WCS_RGV520", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_RGV521_DEVICECODE", table: "WCS_RGV521", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_RGV523_DEVICECODE", table: "WCS_RGV523", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_ROUTE_DEVICECODE", table: "WCS_ROUTE", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_ROUTE_NEXTCODE", table: "WCS_ROUTE", column: "NEXTCODE"); migrationBuilder.CreateIndex( name: "IX_WCS_STATION50_DEVICECODE", table: "WCS_STATION50", column: "DEVICECODE"); migrationBuilder.CreateIndex( name: "IX_WCS_STATION70_DEVICECODE", table: "WCS_STATION70", column: "DEVICECODE"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "WCS_AGVTask"); migrationBuilder.DropTable( name: "WCS_BCR80"); migrationBuilder.DropTable( name: "WCS_CMD"); migrationBuilder.DropTable( name: "WCS_DEVICEPROTOCOL"); migrationBuilder.DropTable( name: "WCS_EXCEPTION"); migrationBuilder.DropTable( name: "WCS_MAPPINGENTRY"); migrationBuilder.DropTable( name: "WCS_PATH"); migrationBuilder.DropTable( name: "WCS_PATHPOINT"); migrationBuilder.DropTable( name: "WCS_RGV520"); migrationBuilder.DropTable( name: "WCS_RGV521"); migrationBuilder.DropTable( name: "WCS_RGV523"); migrationBuilder.DropTable( name: "WCS_ROUTE"); migrationBuilder.DropTable( name: "WCS_STATION50"); migrationBuilder.DropTable( name: "WCS_STATION70"); migrationBuilder.DropTable( name: "WCS_StatusLog"); migrationBuilder.DropTable( name: "WCS_SystemConfig"); migrationBuilder.DropTable( name: "WCS_TASK"); migrationBuilder.DropTable( name: "WCS_Users"); migrationBuilder.DropTable( name: "WCS_DATABLOCK"); migrationBuilder.DropTable( name: "WCS_DEVICE"); migrationBuilder.DropTable( name: "WCS_PLC"); } } }