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.

105 lines
4.6 KiB

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