You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
4.6 KiB

  1. namespace Sevomin.Models.Migrations
  2. {
  3. using System.Data.Entity.Migrations;
  4. public partial class InitialCreate : DbMigration
  5. {
  6. public override void Up()
  7. {
  8. CreateTable(
  9. "dbo.AspNetRoles",
  10. c => new
  11. {
  12. Id = c.String(nullable: false, maxLength: 128),
  13. Name = c.String(nullable: false, maxLength: 256),
  14. })
  15. .PrimaryKey(t => t.Id)
  16. .Index(t => t.Name, unique: true, name: "RoleNameIndex");
  17. CreateTable(
  18. "dbo.AspNetUserRoles",
  19. c => new
  20. {
  21. UserId = c.String(nullable: false, maxLength: 128),
  22. RoleId = c.String(nullable: false, maxLength: 128),
  23. })
  24. .PrimaryKey(t => new { t.UserId, t.RoleId })
  25. .ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
  26. .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
  27. .Index(t => t.UserId)
  28. .Index(t => t.RoleId);
  29. CreateTable(
  30. "dbo.AspNetUsers",
  31. c => new
  32. {
  33. Id = c.String(nullable: false, maxLength: 128),
  34. DisplayName = c.String(),
  35. SignUpDate = c.DateTime(nullable: false),
  36. Email = c.String(maxLength: 256),
  37. EmailConfirmed = c.Boolean(nullable: false),
  38. PasswordHash = c.String(),
  39. SecurityStamp = c.String(),
  40. PhoneNumber = c.String(),
  41. PhoneNumberConfirmed = c.Boolean(nullable: false),
  42. TwoFactorEnabled = c.Boolean(nullable: false),
  43. LockoutEndDateUtc = c.DateTime(),
  44. LockoutEnabled = c.Boolean(nullable: false),
  45. AccessFailedCount = c.Int(nullable: false),
  46. UserName = c.String(nullable: false, maxLength: 256),
  47. CompanyName = c.String(),
  48. FirstName = c.String(),
  49. LastName = c.String(),
  50. Discriminator = c.String(nullable: false, maxLength: 128),
  51. })
  52. .PrimaryKey(t => t.Id)
  53. .Index(t => t.UserName, unique: true, name: "UserNameIndex");
  54. CreateTable(
  55. "dbo.AspNetUserClaims",
  56. c => new
  57. {
  58. Id = c.Int(nullable: false, identity: true),
  59. UserId = c.String(nullable: false, maxLength: 128),
  60. ClaimType = c.String(),
  61. ClaimValue = c.String(),
  62. })
  63. .PrimaryKey(t => t.Id)
  64. .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
  65. .Index(t => t.UserId);
  66. CreateTable(
  67. "dbo.AspNetUserLogins",
  68. c => new
  69. {
  70. LoginProvider = c.String(nullable: false, maxLength: 128),
  71. ProviderKey = c.String(nullable: false, maxLength: 128),
  72. UserId = c.String(nullable: false, maxLength: 128),
  73. })
  74. .PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
  75. .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
  76. .Index(t => t.UserId);
  77. }
  78. public override void Down()
  79. {
  80. DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers");
  81. DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers");
  82. DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers");
  83. DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles");
  84. DropIndex("dbo.AspNetUserLogins", new[] { "UserId" });
  85. DropIndex("dbo.AspNetUserClaims", new[] { "UserId" });
  86. DropIndex("dbo.AspNetUsers", "UserNameIndex");
  87. DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" });
  88. DropIndex("dbo.AspNetUserRoles", new[] { "UserId" });
  89. DropIndex("dbo.AspNetRoles", "RoleNameIndex");
  90. DropTable("dbo.AspNetUserLogins");
  91. DropTable("dbo.AspNetUserClaims");
  92. DropTable("dbo.AspNetUsers");
  93. DropTable("dbo.AspNetUserRoles");
  94. DropTable("dbo.AspNetRoles");
  95. }
  96. }
  97. }