202011050611423_EvalTarget.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 EvalTarget : DbMigration
  8. {
  9. public override void Up()
  10. {
  11. CreateTable(
  12. "dbo.EvalTargetInfoes",
  13. c => new
  14. {
  15. Id = c.String(nullable: false, maxLength: 128),
  16. ParentNo = c.String(maxLength: 128),
  17. Name = c.String(maxLength: 50),
  18. Version = c.String(maxLength: 50),
  19. Description = c.String(maxLength: 500),
  20. TargetType = c.Int(nullable: false),
  21. TypePath = c.String(maxLength: 500),
  22. Remark = c.String(maxLength: 500),
  23. LastModificationTime = c.DateTime(),
  24. LastModifierUserId = c.Long(),
  25. CreationTime = c.DateTime(nullable: false),
  26. CreatorUserId = c.Long(),
  27. })
  28. .PrimaryKey(t => t.Id)
  29. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  30. .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
  31. .ForeignKey("dbo.EvalTargetInfoes", t => t.ParentNo)
  32. .Index(t => t.ParentNo)
  33. .Index(t => t.LastModifierUserId)
  34. .Index(t => t.CreatorUserId);
  35. CreateTable(
  36. "dbo.EvalReportTemplateInfoes",
  37. c => new
  38. {
  39. Id = c.String(nullable: false, maxLength: 128),
  40. Name = c.String(maxLength: 50),
  41. Version = c.String(maxLength: 50),
  42. Description = c.String(maxLength: 500),
  43. Remark = c.String(maxLength: 500),
  44. IsDeleted = c.Boolean(nullable: false),
  45. DeleterUserId = c.Long(),
  46. DeletionTime = c.DateTime(),
  47. LastModificationTime = c.DateTime(),
  48. LastModifierUserId = c.Long(),
  49. CreationTime = c.DateTime(nullable: false),
  50. CreatorUserId = c.Long(),
  51. },
  52. annotations: new Dictionary<string, object>
  53. {
  54. { "DynamicFilter_EvalReportTemplateInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  55. })
  56. .PrimaryKey(t => t.Id)
  57. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  58. .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
  59. .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
  60. .Index(t => t.IsDeleted)
  61. .Index(t => t.DeleterUserId)
  62. .Index(t => t.LastModifierUserId)
  63. .Index(t => t.CreatorUserId);
  64. AddColumn("dbo.WeModel_EvalModels", "QualitativeExpression", c => c.String());
  65. AddColumn("dbo.WeModel_EvalModels", "EvalTargetNo", c => c.String(maxLength: 128));
  66. CreateIndex("dbo.WeModel_EvalModels", "EvalTargetNo");
  67. AddForeignKey("dbo.WeModel_EvalModels", "EvalTargetNo", "dbo.EvalTargetInfoes", "Id");
  68. }
  69. public override void Down()
  70. {
  71. DropForeignKey("dbo.EvalReportTemplateInfoes", "LastModifierUserId", "dbo.Sys_Users");
  72. DropForeignKey("dbo.EvalReportTemplateInfoes", "DeleterUserId", "dbo.Sys_Users");
  73. DropForeignKey("dbo.EvalReportTemplateInfoes", "CreatorUserId", "dbo.Sys_Users");
  74. DropForeignKey("dbo.WeModel_EvalModels", "EvalTargetNo", "dbo.EvalTargetInfoes");
  75. DropForeignKey("dbo.EvalTargetInfoes", "ParentNo", "dbo.EvalTargetInfoes");
  76. DropForeignKey("dbo.EvalTargetInfoes", "LastModifierUserId", "dbo.Sys_Users");
  77. DropForeignKey("dbo.EvalTargetInfoes", "CreatorUserId", "dbo.Sys_Users");
  78. DropIndex("dbo.EvalReportTemplateInfoes", new[] { "CreatorUserId" });
  79. DropIndex("dbo.EvalReportTemplateInfoes", new[] { "LastModifierUserId" });
  80. DropIndex("dbo.EvalReportTemplateInfoes", new[] { "DeleterUserId" });
  81. DropIndex("dbo.EvalReportTemplateInfoes", new[] { "IsDeleted" });
  82. DropIndex("dbo.EvalTargetInfoes", new[] { "CreatorUserId" });
  83. DropIndex("dbo.EvalTargetInfoes", new[] { "LastModifierUserId" });
  84. DropIndex("dbo.EvalTargetInfoes", new[] { "ParentNo" });
  85. DropIndex("dbo.WeModel_EvalModels", new[] { "EvalTargetNo" });
  86. DropColumn("dbo.WeModel_EvalModels", "EvalTargetNo");
  87. DropColumn("dbo.WeModel_EvalModels", "QualitativeExpression");
  88. DropTable("dbo.EvalReportTemplateInfoes",
  89. removedAnnotations: new Dictionary<string, object>
  90. {
  91. { "DynamicFilter_EvalReportTemplateInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  92. });
  93. DropTable("dbo.EvalTargetInfoes");
  94. }
  95. }
  96. }