namespace MileageTraker.Web.Migrations { using System.Data.Entity.Migrations; public partial class AddMembership : DbMigration { public override void Up() { CreateTable( "User", c => new { UserId = c.Guid(nullable: false), Username = c.String(nullable: false), Email = c.String(), Password = c.String(nullable: false), FirstName = c.String(), LastName = c.String(), Comment = c.String(), IsApproved = c.Boolean(nullable: false), PasswordFailuresSinceLastSuccess = c.Int(nullable: false), LastPasswordFailureDate = c.DateTime(), LastActivityDate = c.DateTime(), LastLockoutDate = c.DateTime(), LastLoginDate = c.DateTime(), ConfirmationToken = c.String(), CreateDate = c.DateTime(), IsLockedOut = c.Boolean(nullable: false), LastPasswordChangedDate = c.DateTime(), PasswordVerificationToken = c.String(), PasswordVerificationTokenExpirationDate = c.DateTime(), }) .PrimaryKey(t => t.UserId); CreateTable( "Role", c => new { RoleId = c.Guid(nullable: false), RoleName = c.String(nullable: false), Description = c.String(), }) .PrimaryKey(t => t.RoleId); CreateTable( "RoleUser", c => new { Role_RoleId = c.Guid(nullable: false), User_UserId = c.Guid(nullable: false), }) .PrimaryKey(t => new { t.Role_RoleId, t.User_UserId }) .ForeignKey("Role", t => t.Role_RoleId, cascadeDelete: true) .ForeignKey("User", t => t.User_UserId, cascadeDelete: true) .Index(t => t.Role_RoleId) .Index(t => t.User_UserId); Sql(@"INSERT INTO [Role] ([RoleId] ,[RoleName] ,[Description]) VALUES ('f5bc8c1f-9e8b-4fd8-87d9-27404d8995d5' ,'Administrator' ,'Administrator'), ('bb3bec25-2a4d-467a-b790-e24b53a54717' ,'Developer' ,'Developer')"); Sql(@"INSERT INTO [User] ([UserId] ,[Username] ,[Email] ,[Password] ,[FirstName] ,[LastName] ,[Comment] ,[IsApproved] ,[PasswordFailuresSinceLastSuccess] ,[LastPasswordFailureDate] ,[LastActivityDate] ,[LastLockoutDate] ,[LastLoginDate] ,[ConfirmationToken] ,[CreateDate] ,[IsLockedOut] ,[LastPasswordChangedDate] ,[PasswordVerificationToken] ,[PasswordVerificationTokenExpirationDate]) VALUES ('33EA9A48-628A-458C-A9C9-FBB318C3CF0E' ,'james.kolpack@gmail.com' ,'james.kolpack@gmail.com' ,'AH6VqEzZky4QfexgSwJIgg5gHrjaKGEk7pxUVBZz7X1Vkl31TlCUz9yTxmJN3/IDag==' ,'James' ,'Kolpack' ,NULL ,1 ,0 ,NULL ,NULL ,NULL ,NULL ,NULL ,GETDATE() ,0 ,NULL ,NULL ,NULL)"); Sql(@"INSERT INTO [RoleUser] ([Role_RoleId] ,[User_UserId]) VALUES ('bb3bec25-2a4d-467a-b790-e24b53a54717' ,'33EA9A48-628A-458C-A9C9-FBB318C3CF0E')"); } public override void Down() { DropIndex("RoleUser", new[] { "User_UserId" }); DropIndex("RoleUser", new[] { "Role_RoleId" }); DropForeignKey("RoleUser", "User_UserId", "User"); DropForeignKey("RoleUser", "Role_RoleId", "Role"); DropTable("RoleUser"); DropTable("Role"); DropTable("User"); } } }