123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- 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<Guid>(type: "char(36)", nullable: false),
- C_DeviceCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_ConfigCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_Value = table.Column<string>(type: "varchar(100) CHARACTER SET utf8mb4", maxLength: 100, nullable: false),
- D_CreateOn = table.Column<DateTime>(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<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
- C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
- D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
- C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
- D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
- C_Status = table.Column<string>(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<Guid>(type: "char(36)", nullable: false),
- C_DeviceCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_ConfigCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_Value = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- D_CreateOn = table.Column<DateTime>(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<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_Name = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- I_Interval = table.Column<int>(type: "int", nullable: false),
- C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
- C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
- D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
- C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
- D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
- C_Status = table.Column<string>(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<Guid>(type: "char(36)", nullable: false),
- C_ProductCode = table.Column<string>(type: "varchar(50) CHARACTER SET utf8mb4", maxLength: 50, nullable: false),
- C_MachineCode = table.Column<string>(type: "varchar(255) CHARACTER SET utf8mb4", maxLength: 255, nullable: true),
- C_Remark = table.Column<string>(type: "varchar(1024) CHARACTER SET utf8mb4", maxLength: 1024, nullable: true),
- C_CreateBy = table.Column<Guid>(type: "char(36)", nullable: false),
- D_CreateOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
- C_LastUpdatedBy = table.Column<Guid>(type: "char(36)", nullable: true),
- D_LastUpdatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true),
- I_Status = table.Column<int>(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");
- }
- }
- }
|