202004261547087_UpdateEngineModel.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. namespace WePlatform.Migrations
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data.Entity.Infrastructure.Annotations;
  6. using System.Data.Entity.Migrations;
  7. public partial class UpdateEngineModel : DbMigration
  8. {
  9. public override void Up()
  10. {
  11. DropForeignKey("dbo.WeModel_Engines", "DeleterUserId", "dbo.Sys_Users");
  12. DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles");
  13. DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors");
  14. DropForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users");
  15. DropForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users");
  16. DropForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users");
  17. DropForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles");
  18. DropIndex("dbo.WeModel_Engines", new[] { "IsDeleted" });
  19. DropIndex("dbo.WeModel_Engines", new[] { "DeleterUserId" });
  20. AlterTableAnnotations(
  21. "dbo.WeModel_Engines",
  22. c => new
  23. {
  24. Id = c.String(nullable: false, maxLength: 128),
  25. EngineName = c.String(maxLength: 50),
  26. Version = c.String(maxLength: 50),
  27. Description = c.String(maxLength: 500),
  28. RunnerClassName = c.String(maxLength: 200),
  29. ScoreEvalClassName = c.String(maxLength: 200),
  30. Remark = c.String(maxLength: 500),
  31. LastModificationTime = c.DateTime(),
  32. LastModifierUserId = c.Long(),
  33. CreationTime = c.DateTime(nullable: false),
  34. CreatorUserId = c.Long(),
  35. },
  36. annotations: new Dictionary<string, AnnotationValues>
  37. {
  38. {
  39. "DynamicFilter_EngineInfo_SoftDelete",
  40. new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
  41. },
  42. });
  43. AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles", "Id");
  44. AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors", "Id");
  45. AddForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users", "Id");
  46. AddForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users", "Id");
  47. AddForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users", "Id");
  48. AddForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles", "Id");
  49. DropColumn("dbo.WeModel_Engines", "IsDeleted");
  50. DropColumn("dbo.WeModel_Engines", "DeleterUserId");
  51. DropColumn("dbo.WeModel_Engines", "DeletionTime");
  52. }
  53. public override void Down()
  54. {
  55. AddColumn("dbo.WeModel_Engines", "DeletionTime", c => c.DateTime());
  56. AddColumn("dbo.WeModel_Engines", "DeleterUserId", c => c.Long());
  57. AddColumn("dbo.WeModel_Engines", "IsDeleted", c => c.Boolean(nullable: false));
  58. DropForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles");
  59. DropForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users");
  60. DropForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users");
  61. DropForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users");
  62. DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors");
  63. DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles");
  64. AlterTableAnnotations(
  65. "dbo.WeModel_Engines",
  66. c => new
  67. {
  68. Id = c.String(nullable: false, maxLength: 128),
  69. EngineName = c.String(maxLength: 50),
  70. Version = c.String(maxLength: 50),
  71. Description = c.String(maxLength: 500),
  72. RunnerClassName = c.String(maxLength: 200),
  73. ScoreEvalClassName = c.String(maxLength: 200),
  74. Remark = c.String(maxLength: 500),
  75. LastModificationTime = c.DateTime(),
  76. LastModifierUserId = c.Long(),
  77. CreationTime = c.DateTime(nullable: false),
  78. CreatorUserId = c.Long(),
  79. },
  80. annotations: new Dictionary<string, AnnotationValues>
  81. {
  82. {
  83. "DynamicFilter_EngineInfo_SoftDelete",
  84. new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
  85. },
  86. });
  87. CreateIndex("dbo.WeModel_Engines", "DeleterUserId");
  88. CreateIndex("dbo.WeModel_Engines", "IsDeleted");
  89. AddForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles", "Id", cascadeDelete: true);
  90. AddForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users", "Id", cascadeDelete: true);
  91. AddForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users", "Id", cascadeDelete: true);
  92. AddForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users", "Id", cascadeDelete: true);
  93. AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors", "Id", cascadeDelete: true);
  94. AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles", "Id", cascadeDelete: true);
  95. AddForeignKey("dbo.WeModel_Engines", "DeleterUserId", "dbo.Sys_Users", "Id");
  96. }
  97. }
  98. }