202004260806147_AddGuideRelatedInfo.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. namespace WePlatform.Migrations
  2. {
  3. using System;
  4. using System.Data.Entity.Migrations;
  5. public partial class AddGuideRelatedInfo : DbMigration
  6. {
  7. public override void Up()
  8. {
  9. CreateTable(
  10. "dbo.WeLib_GuideRelated",
  11. c => new
  12. {
  13. Id = c.Int(nullable: false, identity: true),
  14. RelatedNo = c.String(maxLength: 128),
  15. RelatedType = c.Int(nullable: false),
  16. GuideNo = c.String(maxLength: 128),
  17. CreationTime = c.DateTime(nullable: false),
  18. CreatorUserId = c.Long(),
  19. })
  20. .PrimaryKey(t => t.Id)
  21. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  22. .ForeignKey("dbo.WeLib_Guides", t => t.GuideNo)
  23. .Index(t => t.GuideNo)
  24. .Index(t => t.CreatorUserId);
  25. }
  26. public override void Down()
  27. {
  28. DropForeignKey("dbo.WeLib_GuideRelated", "GuideNo", "dbo.WeLib_Guides");
  29. DropForeignKey("dbo.WeLib_GuideRelated", "CreatorUserId", "dbo.Sys_Users");
  30. DropIndex("dbo.WeLib_GuideRelated", new[] { "CreatorUserId" });
  31. DropIndex("dbo.WeLib_GuideRelated", new[] { "GuideNo" });
  32. DropTable("dbo.WeLib_GuideRelated");
  33. }
  34. }
  35. }