202007210140362_UpdateRoleInfo.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 UpdateRoleInfo : DbMigration
  8. {
  9. public override void Up()
  10. {
  11. DropForeignKey("dbo.WeBase_BehaviorRoles", "SceneCategory", "dbo.WeBase_SceneCategories");
  12. DropIndex("dbo.WeBase_BehaviorRoles", new[] { "SceneCategory" });
  13. CreateTable(
  14. "dbo.WeBase_BehaviorRoleRelateCategories",
  15. c => new
  16. {
  17. Id = c.Int(nullable: false, identity: true),
  18. RoleNo = c.String(maxLength: 128),
  19. CategoryNo = c.String(maxLength: 128),
  20. CreationTime = c.DateTime(nullable: false),
  21. CreatorUserId = c.Long(),
  22. })
  23. .PrimaryKey(t => t.Id)
  24. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  25. .ForeignKey("dbo.WeBase_BehaviorRoles", t => t.RoleNo)
  26. .ForeignKey("dbo.WeBase_SceneCategories", t => t.CategoryNo)
  27. .Index(t => t.RoleNo)
  28. .Index(t => t.CategoryNo)
  29. .Index(t => t.CreatorUserId);
  30. AlterTableAnnotations(
  31. "dbo.WeBase_BehaviorRoles",
  32. c => new
  33. {
  34. Id = c.String(nullable: false, maxLength: 128),
  35. RoleName = c.String(maxLength: 50),
  36. Description = c.String(maxLength: 500),
  37. Remark = c.String(maxLength: 500),
  38. IsDeleted = c.Boolean(nullable: false),
  39. DeleterUserId = c.Long(),
  40. DeletionTime = c.DateTime(),
  41. LastModificationTime = c.DateTime(),
  42. LastModifierUserId = c.Long(),
  43. CreationTime = c.DateTime(nullable: false),
  44. CreatorUserId = c.Long(),
  45. },
  46. annotations: new Dictionary<string, AnnotationValues>
  47. {
  48. {
  49. "DynamicFilter_BehaviorRoleInfo_SoftDelete",
  50. new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition")
  51. },
  52. });
  53. AddColumn("dbo.WeBase_BehaviorRoles", "IsDeleted", c => c.Boolean(nullable: false));
  54. AddColumn("dbo.WeBase_BehaviorRoles", "DeleterUserId", c => c.Long());
  55. AddColumn("dbo.WeBase_BehaviorRoles", "DeletionTime", c => c.DateTime());
  56. CreateIndex("dbo.WeBase_BehaviorRoles", "IsDeleted");
  57. CreateIndex("dbo.WeBase_BehaviorRoles", "DeleterUserId");
  58. AddForeignKey("dbo.WeBase_BehaviorRoles", "DeleterUserId", "dbo.Sys_Users", "Id");
  59. DropColumn("dbo.WeBase_BehaviorRoles", "SceneCategory");
  60. }
  61. public override void Down()
  62. {
  63. AddColumn("dbo.WeBase_BehaviorRoles", "SceneCategory", c => c.String(maxLength: 128));
  64. DropForeignKey("dbo.WeBase_BehaviorRoleRelateCategories", "CategoryNo", "dbo.WeBase_SceneCategories");
  65. DropForeignKey("dbo.WeBase_BehaviorRoleRelateCategories", "RoleNo", "dbo.WeBase_BehaviorRoles");
  66. DropForeignKey("dbo.WeBase_BehaviorRoleRelateCategories", "CreatorUserId", "dbo.Sys_Users");
  67. DropForeignKey("dbo.WeBase_BehaviorRoles", "DeleterUserId", "dbo.Sys_Users");
  68. DropIndex("dbo.WeBase_BehaviorRoleRelateCategories", new[] { "CreatorUserId" });
  69. DropIndex("dbo.WeBase_BehaviorRoleRelateCategories", new[] { "CategoryNo" });
  70. DropIndex("dbo.WeBase_BehaviorRoleRelateCategories", new[] { "RoleNo" });
  71. DropIndex("dbo.WeBase_BehaviorRoles", new[] { "DeleterUserId" });
  72. DropIndex("dbo.WeBase_BehaviorRoles", new[] { "IsDeleted" });
  73. DropColumn("dbo.WeBase_BehaviorRoles", "DeletionTime");
  74. DropColumn("dbo.WeBase_BehaviorRoles", "DeleterUserId");
  75. DropColumn("dbo.WeBase_BehaviorRoles", "IsDeleted");
  76. AlterTableAnnotations(
  77. "dbo.WeBase_BehaviorRoles",
  78. c => new
  79. {
  80. Id = c.String(nullable: false, maxLength: 128),
  81. RoleName = c.String(maxLength: 50),
  82. Description = c.String(maxLength: 500),
  83. Remark = c.String(maxLength: 500),
  84. IsDeleted = c.Boolean(nullable: false),
  85. DeleterUserId = c.Long(),
  86. DeletionTime = c.DateTime(),
  87. LastModificationTime = c.DateTime(),
  88. LastModifierUserId = c.Long(),
  89. CreationTime = c.DateTime(nullable: false),
  90. CreatorUserId = c.Long(),
  91. },
  92. annotations: new Dictionary<string, AnnotationValues>
  93. {
  94. {
  95. "DynamicFilter_BehaviorRoleInfo_SoftDelete",
  96. new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null)
  97. },
  98. });
  99. DropTable("dbo.WeBase_BehaviorRoleRelateCategories");
  100. CreateIndex("dbo.WeBase_BehaviorRoles", "SceneCategory");
  101. AddForeignKey("dbo.WeBase_BehaviorRoles", "SceneCategory", "dbo.WeBase_SceneCategories", "Id");
  102. }
  103. }
  104. }