Advertisement
Guest User

Untitled

a guest
Oct 28th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. namespace ScrumX.API.Migrations
  2. {
  3. using System;
  4. using System.Data.Entity.Migrations;
  5.  
  6. public partial class Add : DbMigration
  7. {
  8. public override void Up()
  9. {
  10. CreateTable(
  11. "dbo.HistoryJobs",
  12. c => new
  13. {
  14. IdHistoryJob = c.Int(nullable: false, identity: true),
  15. IdJob = c.Int(nullable: false),
  16. IdUser = c.Int(nullable: false),
  17. Comment = c.String(),
  18. FromBacklog = c.Int(nullable: false),
  19. ToBacklog = c.Int(nullable: false),
  20. FromTable = c.Int(nullable: false),
  21. ToTable = c.Int(nullable: false),
  22. })
  23. .PrimaryKey(t => t.IdHistoryJob)
  24. .ForeignKey("dbo.Jobs", t => t.IdJob, cascadeDelete: true)
  25. .ForeignKey("dbo.Users", t => t.IdUser, cascadeDelete: true)
  26. .Index(t => t.IdJob)
  27. .Index(t => t.IdUser);
  28.  
  29. CreateTable(
  30. "dbo.Jobs",
  31. c => new
  32. {
  33. IdJob = c.Int(nullable: false, identity: true),
  34. IdSprint = c.Int(nullable: false),
  35. IdUser = c.Int(nullable: false),
  36. Title = c.String(),
  37. Desc = c.String(),
  38. Priority = c.Int(),
  39. SP = c.Int(),
  40. BacklogStatus = c.Int(nullable: false),
  41. TableStatus = c.Int(nullable: false),
  42. })
  43. .PrimaryKey(t => t.IdJob)
  44. .ForeignKey("dbo.Sprints", t => t.IdSprint, cascadeDelete: true)
  45. .ForeignKey("dbo.Users", t => t.IdUser, cascadeDelete: false)
  46. .Index(t => t.IdSprint)
  47. .Index(t => t.IdUser)
  48. .Index(t => t.BacklogStatus)
  49. .Index(t => t.TableStatus);
  50.  
  51. CreateTable(
  52. "dbo.Sprints",
  53. c => new
  54. {
  55. IdSprint = c.Int(nullable: false, identity: true),
  56. IdProject = c.Int(nullable: false),
  57. NoSprint = c.Int(nullable: false),
  58. Title = c.String(),
  59. StartData = c.DateTime(nullable: false),
  60. EndData = c.DateTime(),
  61. })
  62. .PrimaryKey(t => t.IdSprint)
  63. .ForeignKey("dbo.Projects", t => t.IdProject, cascadeDelete: true)
  64. .Index(t => t.IdProject);
  65.  
  66. CreateTable(
  67. "dbo.Projects",
  68. c => new
  69. {
  70. IdProject = c.Int(nullable: false, identity: true),
  71. Name = c.String(),
  72. DayCreated = c.DateTime(nullable: false),
  73. })
  74. .PrimaryKey(t => t.IdProject);
  75.  
  76. CreateTable(
  77. "dbo.Users",
  78. c => new
  79. {
  80. IdUser = c.Int(nullable: false, identity: true),
  81. Name = c.String(maxLength: 20),
  82. Password = c.String(),
  83. })
  84. .PrimaryKey(t => t.IdUser);
  85.  
  86. }
  87.  
  88. public override void Down()
  89. {
  90. DropForeignKey("dbo.HistoryJobs", "IdUser", "dbo.Users");
  91. DropForeignKey("dbo.Jobs", "IdUser", "dbo.Users");
  92. DropForeignKey("dbo.Jobs", "IdSprint", "dbo.Sprints");
  93. DropForeignKey("dbo.Sprints", "IdProject", "dbo.Projects");
  94. DropForeignKey("dbo.HistoryJobs", "IdJob", "dbo.Jobs");
  95. DropIndex("dbo.Sprints", new[] { "IdProject" });
  96. DropIndex("dbo.Jobs", new[] { "TableStatus" });
  97. DropIndex("dbo.Jobs", new[] { "BacklogStatus" });
  98. DropIndex("dbo.Jobs", new[] { "IdUser" });
  99. DropIndex("dbo.Jobs", new[] { "IdSprint" });
  100. DropIndex("dbo.HistoryJobs", new[] { "IdUser" });
  101. DropIndex("dbo.HistoryJobs", new[] { "IdJob" });
  102. DropTable("dbo.Users");
  103. DropTable("dbo.Projects");
  104. DropTable("dbo.Sprints");
  105. DropTable("dbo.Jobs");
  106. DropTable("dbo.HistoryJobs");
  107. }
  108. }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement