using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; using Microsoft.Data.Entity.Relational.Migrations; using Microsoft.Data.Entity.Relational.Migrations.Builders; using Microsoft.Data.Entity.Relational.Migrations.Infrastructure; namespace <%= namespace %>.Migrations { public partial class CreateIdentitySchema : Migration { public override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable("AspNetRoles", c => new { Id = c.String(), Name = c.String() }) .PrimaryKey("PK_AspNetRoles", t => t.Id); migrationBuilder.CreateTable("AspNetRoleClaims", c => new { Id = c.Int(nullable: false, identity: true), ClaimType = c.String(), ClaimValue = c.String(), RoleId = c.String() }) .PrimaryKey("PK_AspNetRoleClaims", t => t.Id); migrationBuilder.CreateTable("AspNetUserClaims", c => new { Id = c.Int(nullable: false, identity: true), ClaimType = c.String(), ClaimValue = c.String(), UserId = c.String() }) .PrimaryKey("PK_AspNetUserClaims", t => t.Id); migrationBuilder.CreateTable("AspNetUserLogins", c => new { LoginProvider = c.String(), ProviderKey = c.String(), ProviderDisplayName = c.String(), UserId = c.String() }) .PrimaryKey("PK_AspNetUserLogins", t => new { t.LoginProvider, t.ProviderKey }); migrationBuilder.CreateTable("AspNetUserRoles", c => new { UserId = c.String(), RoleId = c.String() }) .PrimaryKey("PK_AspNetUserRoles", t => new { t.UserId, t.RoleId }); migrationBuilder.CreateTable("AspNetUsers", c => new { Id = c.String(), AccessFailedCount = c.Int(nullable: false), ConcurrencyStamp = c.String(), Email = c.String(), EmailConfirmed = c.Boolean(nullable: false), LockoutEnabled = c.Boolean(nullable: false), LockoutEnd = c.DateTimeOffset(), NormalizedEmail = c.String(), NormalizedUserName = c.String(), PasswordHash = c.String(), PhoneNumber = c.String(), PhoneNumberConfirmed = c.Boolean(nullable: false), SecurityStamp = c.String(), TwoFactorEnabled = c.Boolean(nullable: false), UserName = c.String() }) .PrimaryKey("PK_AspNetUsers", t => t.Id); migrationBuilder.AddForeignKey( "AspNetRoleClaims", "FK_AspNetRoleClaims_AspNetRoles_RoleId", new[] { "RoleId" }, "AspNetRoles", new[] { "Id" }, cascadeDelete: false); migrationBuilder.AddForeignKey( "AspNetUserClaims", "FK_AspNetUserClaims_AspNetUsers_UserId", new[] { "UserId" }, "AspNetUsers", new[] { "Id" }, cascadeDelete: false); migrationBuilder.AddForeignKey( "AspNetUserLogins", "FK_AspNetUserLogins_AspNetUsers_UserId", new[] { "UserId" }, "AspNetUsers", new[] { "Id" }, cascadeDelete: false); } public override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey("AspNetRoleClaims", "FK_AspNetRoleClaims_AspNetRoles_RoleId"); migrationBuilder.DropForeignKey("AspNetUserClaims", "FK_AspNetUserClaims_AspNetUsers_UserId"); migrationBuilder.DropForeignKey("AspNetUserLogins", "FK_AspNetUserLogins_AspNetUsers_UserId"); migrationBuilder.DropTable("AspNetRoles"); migrationBuilder.DropTable("AspNetRoleClaims"); migrationBuilder.DropTable("AspNetUserClaims"); migrationBuilder.DropTable("AspNetUserLogins"); migrationBuilder.DropTable("AspNetUserRoles"); migrationBuilder.DropTable("AspNetUsers"); } } [ContextType(typeof(Models.ApplicationDbContext))] public partial class CreateIdentitySchema : IMigrationMetadata { string IMigrationMetadata.MigrationId { get { return "000000000000000_CreateIdentitySchema"; } } string IMigrationMetadata.ProductVersion { get { return "7.0.0-beta2"; } } IModel IMigrationMetadata.TargetModel { get { var builder = new BasicModelBuilder(); builder.Entity("Microsoft.AspNet.Identity.IdentityRole", b => { b.Property("Id"); b.Property("Name"); b.Key("Id"); b.ForRelational().Table("AspNetRoles"); }); builder.Entity("Microsoft.AspNet.Identity.IdentityRoleClaim`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", b => { b.Property("ClaimType"); b.Property("ClaimValue"); b.Property("Id") .GenerateValueOnAdd(); b.Property("RoleId"); b.Key("Id"); b.ForRelational().Table("AspNetRoleClaims"); }); builder.Entity("Microsoft.AspNet.Identity.IdentityUserClaim`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", b => { b.Property("ClaimType"); b.Property("ClaimValue"); b.Property("Id") .GenerateValueOnAdd(); b.Property("UserId"); b.Key("Id"); b.ForRelational().Table("AspNetUserClaims"); }); builder.Entity("Microsoft.AspNet.Identity.IdentityUserLogin`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", b => { b.Property("LoginProvider"); b.Property("ProviderDisplayName"); b.Property("ProviderKey"); b.Property("UserId"); b.Key("LoginProvider", "ProviderKey"); b.ForRelational().Table("AspNetUserLogins"); }); builder.Entity("Microsoft.AspNet.Identity.IdentityUserRole`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", b => { b.Property("RoleId"); b.Property("UserId"); b.Key("UserId", "RoleId"); b.ForRelational().Table("AspNetUserRoles"); }); builder.Entity("<%= namespace %>.Models.ApplicationUser", b => { b.Property("AccessFailedCount"); b.Property("ConcurrencyStamp"); b.Property("Email"); b.Property("EmailConfirmed"); b.Property("Id"); b.Property("LockoutEnabled"); b.Property("LockoutEnd"); b.Property("NormalizedEmail"); b.Property("NormalizedUserName"); b.Property("PasswordHash"); b.Property("PhoneNumber"); b.Property("PhoneNumberConfirmed"); b.Property("SecurityStamp"); b.Property("TwoFactorEnabled"); b.Property("UserName"); b.Key("Id"); b.ForRelational().Table("AspNetUsers"); }); builder.Entity("Microsoft.AspNet.Identity.IdentityRoleClaim`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", b => { b.ForeignKey("Microsoft.AspNet.Identity.IdentityRole", "RoleId"); }); builder.Entity("Microsoft.AspNet.Identity.IdentityUserClaim`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", b => { b.ForeignKey("<%= namespace %>.Models.ApplicationUser", "UserId"); }); builder.Entity("Microsoft.AspNet.Identity.IdentityUserLogin`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", b => { b.ForeignKey("<%= namespace %>.Models.ApplicationUser", "UserId"); }); return builder.Model; } } } }