using System; using Microsoft.EntityFrameworkCore.Migrations; namespace Ropin.Inspection.Model.Migrations { public partial class EdDev : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "TDEV_DevAlert", columns: table => new { C_ID = table.Column(type: "char(36)", nullable: false), C_DeviceCode = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_ConfigCode = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_Value = table.Column(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false), D_CreateOn = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TDEV_DevAlert", x => x.C_ID); }); migrationBuilder.CreateTable( name: "TDEV_DevAlertConfig", columns: table => new { C_Code = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_Name = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_Remark = table.Column(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true), C_CreateBy = table.Column(type: "char(36)", nullable: false), D_CreateOn = table.Column(type: "datetime(6)", nullable: false), C_LastUpdatedBy = table.Column(type: "char(36)", nullable: true), D_LastUpdatedOn = table.Column(type: "datetime(6)", nullable: true), C_Status = table.Column(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TDEV_DevAlertConfig", x => x.C_Code); table.ForeignKey( name: "FK_TDEV_DevAlertConfig_TSYS_User_C_CreateBy", column: x => x.C_CreateBy, principalTable: "TSYS_User", principalColumn: "C_UserID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_TDEV_DevAlertConfig_TSYS_User_C_LastUpdatedBy", column: x => x.C_LastUpdatedBy, principalTable: "TSYS_User", principalColumn: "C_UserID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "TDEV_DevData", columns: table => new { C_ID = table.Column(type: "char(36)", nullable: false), C_DeviceCode = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_ConfigCode = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_Value = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), D_CreateOn = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TDEV_DevData", x => x.C_ID); }); migrationBuilder.CreateTable( name: "TDEV_DevDataConfig", columns: table => new { C_Code = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_Name = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), I_Interval = table.Column(type: "int", nullable: false), C_Remark = table.Column(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true), C_CreateBy = table.Column(type: "char(36)", nullable: false), D_CreateOn = table.Column(type: "datetime(6)", nullable: false), C_LastUpdatedBy = table.Column(type: "char(36)", nullable: true), D_LastUpdatedOn = table.Column(type: "datetime(6)", nullable: true), C_Status = table.Column(type: "varchar(1) CHARACTER SET utf8mb4", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TDEV_DevDataConfig", x => x.C_Code); table.ForeignKey( name: "FK_TDEV_DevDataConfig_TSYS_User_C_CreateBy", column: x => x.C_CreateBy, principalTable: "TSYS_User", principalColumn: "C_UserID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_TDEV_DevDataConfig_TSYS_User_C_LastUpdatedBy", column: x => x.C_LastUpdatedBy, principalTable: "TSYS_User", principalColumn: "C_UserID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "TDEV_Device", columns: table => new { C_Code = table.Column(type: "char(36)", nullable: false), C_ProductCode = table.Column(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false), C_MachineCode = table.Column(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: true), C_Remark = table.Column(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true), C_CreateBy = table.Column(type: "char(36)", nullable: false), D_CreateOn = table.Column(type: "datetime(6)", nullable: false), C_LastUpdatedBy = table.Column(type: "char(36)", nullable: true), D_LastUpdatedOn = table.Column(type: "datetime(6)", nullable: true), I_Status = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_TDEV_Device", x => x.C_Code); table.ForeignKey( name: "FK_TDEV_Device_TSYS_User_C_CreateBy", column: x => x.C_CreateBy, principalTable: "TSYS_User", principalColumn: "C_UserID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_TDEV_Device_TSYS_User_C_LastUpdatedBy", column: x => x.C_LastUpdatedBy, principalTable: "TSYS_User", principalColumn: "C_UserID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_TDEV_DevAlertConfig_C_CreateBy", table: "TDEV_DevAlertConfig", column: "C_CreateBy"); migrationBuilder.CreateIndex( name: "IX_TDEV_DevAlertConfig_C_LastUpdatedBy", table: "TDEV_DevAlertConfig", column: "C_LastUpdatedBy"); migrationBuilder.CreateIndex( name: "IX_TDEV_DevDataConfig_C_CreateBy", table: "TDEV_DevDataConfig", column: "C_CreateBy"); migrationBuilder.CreateIndex( name: "IX_TDEV_DevDataConfig_C_LastUpdatedBy", table: "TDEV_DevDataConfig", column: "C_LastUpdatedBy"); migrationBuilder.CreateIndex( name: "IX_TDEV_Device_C_CreateBy", table: "TDEV_Device", column: "C_CreateBy"); migrationBuilder.CreateIndex( name: "IX_TDEV_Device_C_LastUpdatedBy", table: "TDEV_Device", column: "C_LastUpdatedBy"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "TDEV_DevAlert"); migrationBuilder.DropTable( name: "TDEV_DevAlertConfig"); migrationBuilder.DropTable( name: "TDEV_DevData"); migrationBuilder.DropTable( name: "TDEV_DevDataConfig"); migrationBuilder.DropTable( name: "TDEV_Device"); } } }