202005290625336_Update200529001.cs 1.7 KB

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