202006280131016_AddEvalModel.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. namespace WePlatform.Migrations
  2. {
  3. using System;
  4. using System.Data.Entity.Migrations;
  5. public partial class AddEvalModel : DbMigration
  6. {
  7. public override void Up()
  8. {
  9. CreateTable(
  10. "dbo.WeModel_EvalModels",
  11. c => new
  12. {
  13. Id = c.String(nullable: false, maxLength: 128),
  14. ModelName = c.String(maxLength: 50),
  15. Version = c.String(maxLength: 50),
  16. Description = c.String(maxLength: 500),
  17. Remark = c.String(maxLength: 500),
  18. LastModificationTime = c.DateTime(),
  19. LastModifierUserId = c.Long(),
  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.Sys_Users", t => t.LastModifierUserId)
  26. .Index(t => t.LastModifierUserId)
  27. .Index(t => t.CreatorUserId);
  28. AddColumn("dbo.WeLib_Packages", "EvalModelNo", c => c.String(maxLength: 128));
  29. CreateIndex("dbo.WeLib_Packages", "EvalModelNo");
  30. AddForeignKey("dbo.WeLib_Packages", "EvalModelNo", "dbo.WeModel_EvalModels", "Id");
  31. }
  32. public override void Down()
  33. {
  34. DropForeignKey("dbo.WeLib_Packages", "EvalModelNo", "dbo.WeModel_EvalModels");
  35. DropForeignKey("dbo.WeModel_EvalModels", "LastModifierUserId", "dbo.Sys_Users");
  36. DropForeignKey("dbo.WeModel_EvalModels", "CreatorUserId", "dbo.Sys_Users");
  37. DropIndex("dbo.WeLib_Packages", new[] { "EvalModelNo" });
  38. DropIndex("dbo.WeModel_EvalModels", new[] { "CreatorUserId" });
  39. DropIndex("dbo.WeModel_EvalModels", new[] { "LastModifierUserId" });
  40. DropColumn("dbo.WeLib_Packages", "EvalModelNo");
  41. DropTable("dbo.WeModel_EvalModels");
  42. }
  43. }
  44. }