using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace RB_MES_APICore.Migrations { /// public partial class updateInfoV1 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "r_JoinTb"); migrationBuilder.DropTable( name: "r_K3DefaultColVals"); migrationBuilder.DropTable( name: "r_MesRequestStatus"); migrationBuilder.DropTable( name: "r_SCol"); migrationBuilder.DropColumn( name: "FIsDetail", table: "r_FunctionList"); migrationBuilder.AlterColumn( name: "FSource", table: "RBLog", type: "nvarchar(max)", nullable: false, oldClrType: typeof(string), oldType: "xml"); migrationBuilder.AlterColumn( name: "FMess", table: "RBLog", type: "nvarchar(max)", nullable: false, oldClrType: typeof(string), oldType: "nvarchar(255)", oldMaxLength: 255); migrationBuilder.AlterColumn( name: "FDocType", table: "RBLog", type: "nvarchar(200)", maxLength: 200, nullable: false, oldClrType: typeof(string), oldType: "nvarchar(80)", oldMaxLength: 80); migrationBuilder.AddColumn( name: "FGUID", table: "RBLog", type: "nvarchar(max)", nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "FGuidColName", table: "r_FormIDType", type: "nvarchar(100)", maxLength: 100, nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "FNeedBreakSQL", table: "r_FormIDType", type: "nvarchar(500)", maxLength: 500, nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "FIndexID", table: "r_ClumnConvert", type: "int", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "r_ApiHostServices", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FActionName = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), FDocType = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), FTimer = table.Column(type: "int", maxLength: 80, nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_ApiHostServices", x => x.FID); }); migrationBuilder.CreateTable( name: "r_BillTypeRules", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FPostTypeID = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), FSBillTypeNumber = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), FDBillTypeNumber = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_BillTypeRules", x => x.FID); }); migrationBuilder.CreateTable( name: "r_CustomServices", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FApiGroupID = table.Column(type: "int", maxLength: 255, nullable: false), FNamespace = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), FClassName = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), FActionName = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), FAppComponents = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_CustomServices", x => x.FID); table.ForeignKey( name: "FK_r_CustomServices_APIGrou_FApiGroupID", column: x => x.FApiGroupID, principalTable: "APIGrou", principalColumn: "FID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "r_DataSaveBatch", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FDocTypeID = table.Column(type: "int", nullable: false), FNumberSearch = table.Column(type: "bit", nullable: false), FValidateFlag = table.Column(type: "bit", nullable: false), FIsDeleteEntry = table.Column(type: "bit", nullable: false), FIsEntryBatchFill = table.Column(type: "bit", nullable: false), FNeedUpDateFields = table.Column(type: "nvarchar(max)", nullable: false), FNeedReturnFields = table.Column(type: "nvarchar(max)", nullable: false), FSubSystemId = table.Column(type: "nvarchar(max)", nullable: false), FInterationFlags = table.Column(type: "nvarchar(max)", nullable: false), FIsAutoSubmitAndAudit = table.Column(type: "bit", nullable: false), FBatchCount = table.Column(type: "int", nullable: false), FIsVerifyBaseDataField = table.Column(type: "bit", nullable: false), FIsAutoAdjustField = table.Column(type: "bit", nullable: false), FIgnoreInterationFlag = table.Column(type: "bit", nullable: false), FIsControlPrecision = table.Column(type: "bit", nullable: false), FValidateRepeatJson = table.Column(type: "bit", nullable: false), FSubmitUrl = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), FAuditUrl = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: false), FErpBillType = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_DataSaveBatch", x => x.FID); table.ForeignKey( name: "FK_r_DataSaveBatch_r_FormIDType_FDocTypeID", column: x => x.FDocTypeID, principalTable: "r_FormIDType", principalColumn: "FID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "r_LockPRD_MO", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ERP_MO = table.Column(type: "nvarchar(36)", maxLength: 36, nullable: false), MO_SEQ = table.Column(type: "nvarchar(450)", nullable: false), MOID = table.Column(type: "nvarchar(max)", nullable: false), MOEntryID = table.Column(type: "nvarchar(max)", nullable: false), TRX_DATE = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_LockPRD_MO", x => x.FID); }); migrationBuilder.CreateTable( name: "r_ReciveDataBack", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FDocType = table.Column(type: "nvarchar(450)", nullable: false), FBillNo = table.Column(type: "nvarchar(max)", nullable: false), FErpID = table.Column(type: "int", nullable: false), FSeq = table.Column(type: "int", nullable: false), QUEUE_ID = table.Column(type: "nvarchar(max)", nullable: false), FJson = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_ReciveDataBack", x => x.FID); }); migrationBuilder.CreateTable( name: "t_AuthorizationInfo", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FAppKey = table.Column(type: "nvarchar(max)", nullable: false), FAppSecret = table.Column(type: "nvarchar(max)", nullable: false), FAuthCode = table.Column(type: "nvarchar(max)", nullable: false), FAppTicket = table.Column(type: "nvarchar(max)", nullable: true), FUserCode = table.Column(type: "nvarchar(max)", nullable: true), FUserAuthPermanentCode = table.Column(type: "nvarchar(max)", nullable: true), FAppAccessToken = table.Column(type: "nvarchar(max)", nullable: true), FOrgAuthTempCode = table.Column(type: "nvarchar(max)", nullable: true), FOrgAuthPermanentCode = table.Column(type: "nvarchar(max)", nullable: true), FOrgAccessToken = table.Column(type: "nvarchar(max)", nullable: true), FToken = table.Column(type: "nvarchar(max)", nullable: true), FStartDate = table.Column(type: "datetime2", nullable: false), FExpireDate = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_t_AuthorizationInfo", x => x.FID); }); migrationBuilder.CreateIndex( name: "IX_r_BillTypeRules_FPostTypeID_FSBillTypeNumber", table: "r_BillTypeRules", columns: new[] { "FPostTypeID", "FSBillTypeNumber" }); migrationBuilder.CreateIndex( name: "IX_r_CustomServices_FApiGroupID", table: "r_CustomServices", column: "FApiGroupID"); migrationBuilder.CreateIndex( name: "IX_r_DataSaveBatch_FDocTypeID", table: "r_DataSaveBatch", column: "FDocTypeID"); migrationBuilder.CreateIndex( name: "IX_r_LockPRD_MO_ERP_MO_MO_SEQ", table: "r_LockPRD_MO", columns: new[] { "ERP_MO", "MO_SEQ" }); migrationBuilder.CreateIndex( name: "IX_r_ReciveDataBack_FDocType_FErpID_FSeq", table: "r_ReciveDataBack", columns: new[] { "FDocType", "FErpID", "FSeq" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "r_ApiHostServices"); migrationBuilder.DropTable( name: "r_BillTypeRules"); migrationBuilder.DropTable( name: "r_CustomServices"); migrationBuilder.DropTable( name: "r_DataSaveBatch"); migrationBuilder.DropTable( name: "r_LockPRD_MO"); migrationBuilder.DropTable( name: "r_ReciveDataBack"); migrationBuilder.DropTable( name: "t_AuthorizationInfo"); migrationBuilder.DropColumn( name: "FGUID", table: "RBLog"); migrationBuilder.DropColumn( name: "FGuidColName", table: "r_FormIDType"); migrationBuilder.DropColumn( name: "FNeedBreakSQL", table: "r_FormIDType"); migrationBuilder.DropColumn( name: "FIndexID", table: "r_ClumnConvert"); migrationBuilder.AlterColumn( name: "FSource", table: "RBLog", type: "xml", nullable: false, oldClrType: typeof(string), oldType: "nvarchar(max)"); migrationBuilder.AlterColumn( name: "FMess", table: "RBLog", type: "nvarchar(255)", maxLength: 255, nullable: false, oldClrType: typeof(string), oldType: "nvarchar(max)"); migrationBuilder.AlterColumn( name: "FDocType", table: "RBLog", type: "nvarchar(80)", maxLength: 80, nullable: false, oldClrType: typeof(string), oldType: "nvarchar(200)", oldMaxLength: 200); migrationBuilder.AddColumn( name: "FIsDetail", table: "r_FunctionList", type: "bit", nullable: false, defaultValue: false); migrationBuilder.CreateTable( name: "r_JoinTb", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FSID = table.Column(type: "int", nullable: false), FAsName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), FCondition = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false), FCtlID = table.Column(type: "int", nullable: false), FJoinSymbol = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), FJoinType = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), FTbName = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_JoinTb", x => x.FID); table.ForeignKey( name: "FK_r_JoinTb_r_SelectJoinID_FSID", column: x => x.FSID, principalTable: "r_SelectJoinID", principalColumn: "FID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "r_K3DefaultColVals", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FReceiveID = table.Column(type: "int", nullable: false), FDescribe = table.Column(type: "nvarchar(max)", nullable: true), FPageID = table.Column(type: "int", nullable: false), FSqlType = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), FVal = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), K3FiledName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_K3DefaultColVals", x => x.FID); table.ForeignKey( name: "FK_r_K3DefaultColVals_r_ReceiveStockBillTypes_FReceiveID", column: x => x.FReceiveID, principalTable: "r_ReceiveStockBillTypes", principalColumn: "FID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "r_MesRequestStatus", columns: table => new { FID = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), FERPBillType = table.Column(type: "int", nullable: false), FERPBillID = table.Column(type: "int", nullable: false), FERPBillEntryID = table.Column(type: "int", nullable: false), FIMSDocType = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), FRequestKey = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), FStatus = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_MesRequestStatus", x => new { x.FID, x.FERPBillType, x.FERPBillID, x.FERPBillEntryID }); }); migrationBuilder.CreateTable( name: "r_SCol", columns: table => new { FID = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), FSID = table.Column(type: "int", nullable: false), FAsName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), FAsTable = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), FColName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), FCtlID = table.Column(type: "int", nullable: false), FDeaful = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false) }, constraints: table => { table.PrimaryKey("PK_r_SCol", x => x.FID); table.ForeignKey( name: "FK_r_SCol_r_SelectJoinID_FSID", column: x => x.FSID, principalTable: "r_SelectJoinID", principalColumn: "FID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_r_JoinTb_FSID_FCtlID", table: "r_JoinTb", columns: new[] { "FSID", "FCtlID" }, unique: true); migrationBuilder.CreateIndex( name: "IX_r_K3DefaultColVals_FReceiveID_FPageID_K3FiledName", table: "r_K3DefaultColVals", columns: new[] { "FReceiveID", "FPageID", "K3FiledName" }, unique: true); migrationBuilder.CreateIndex( name: "IX_r_SCol_FSID_FAsName", table: "r_SCol", columns: new[] { "FSID", "FAsName" }, unique: true); migrationBuilder.CreateIndex( name: "IX_r_SCol_FSID_FCtlID", table: "r_SCol", columns: new[] { "FSID", "FCtlID" }, unique: true); } } }