202005070611353_AddComponent.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 AddComponent : DbMigration
  8. {
  9. public override void Up()
  10. {
  11. CreateTable(
  12. "dbo.WeModel_Components",
  13. c => new
  14. {
  15. Id = c.String(nullable: false, maxLength: 128),
  16. Name = c.String(maxLength: 50),
  17. Parameters = c.String(maxLength: 1000),
  18. Description = c.String(maxLength: 500),
  19. ComponentScript = c.String(),
  20. ComponentClass = c.String(maxLength: 100),
  21. ComponentLib = c.String(maxLength: 100),
  22. RegisterKey = c.String(maxLength: 100),
  23. Remark = c.String(maxLength: 500),
  24. IsDeleted = c.Boolean(nullable: false),
  25. DeleterUserId = c.Long(),
  26. DeletionTime = c.DateTime(),
  27. LastModificationTime = c.DateTime(),
  28. LastModifierUserId = c.Long(),
  29. CreationTime = c.DateTime(nullable: false),
  30. CreatorUserId = c.Long(),
  31. },
  32. annotations: new Dictionary<string, object>
  33. {
  34. { "DynamicFilter_EngineComponentInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  35. })
  36. .PrimaryKey(t => t.Id)
  37. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  38. .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
  39. .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
  40. .Index(t => t.IsDeleted)
  41. .Index(t => t.DeleterUserId)
  42. .Index(t => t.LastModifierUserId)
  43. .Index(t => t.CreatorUserId);
  44. AddColumn("dbo.WeModel_Engines", "EngineTypeName", c => c.String(maxLength: 50));
  45. DropColumn("dbo.WeModel_Engines", "RunnerClassName");
  46. DropColumn("dbo.WeModel_Engines", "ScoreEvalClassName");
  47. }
  48. public override void Down()
  49. {
  50. AddColumn("dbo.WeModel_Engines", "ScoreEvalClassName", c => c.String(maxLength: 200));
  51. AddColumn("dbo.WeModel_Engines", "RunnerClassName", c => c.String(maxLength: 200));
  52. DropForeignKey("dbo.WeModel_Components", "LastModifierUserId", "dbo.Sys_Users");
  53. DropForeignKey("dbo.WeModel_Components", "DeleterUserId", "dbo.Sys_Users");
  54. DropForeignKey("dbo.WeModel_Components", "CreatorUserId", "dbo.Sys_Users");
  55. DropIndex("dbo.WeModel_Components", new[] { "CreatorUserId" });
  56. DropIndex("dbo.WeModel_Components", new[] { "LastModifierUserId" });
  57. DropIndex("dbo.WeModel_Components", new[] { "DeleterUserId" });
  58. DropIndex("dbo.WeModel_Components", new[] { "IsDeleted" });
  59. DropColumn("dbo.WeModel_Engines", "EngineTypeName");
  60. DropTable("dbo.WeModel_Components",
  61. removedAnnotations: new Dictionary<string, object>
  62. {
  63. { "DynamicFilter_EngineComponentInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  64. });
  65. }
  66. }
  67. }