context: namespace StationCAD.Model.IdentityDBMigrations
  {
      using System;
      using System.Data.Entity.Migrations;
      
      public partial class Initial : DbMigration
      {
          public override void Up()
          {
              CreateTable(
                  "dbo.Role",
                  c => new
                      {
                          RoleId = c.String(nullable: false, maxLength: 128),
                          Name = c.String(),
                      })
                  .PrimaryKey(t => t.RoleId);
              
              CreateTable(
                  "dbo.UserRole",
                  c => new
                      {
                          UserId = c.String(nullable: false, maxLength: 128),
                          RoleId = c.String(nullable: false, maxLength: 128),
                      })
                  .PrimaryKey(t => new { t.UserId, t.RoleId })
                  .ForeignKey("dbo.Role", t => t.RoleId, cascadeDelete: true)
                  .ForeignKey("dbo.User", t => t.UserId, cascadeDelete: true)
                  .Index(t => t.UserId)
                  .Index(t => t.RoleId);
              
              CreateTable(
                  "dbo.User",
                  c => new
                      {
                          UserId = c.String(nullable: false, maxLength: 128),
                          Email = c.String(),
                          EmailConfirmed = c.Boolean(nullable: false),
                          PasswordHash = c.String(),
                          SecurityStamp = c.String(),
                          PhoneNumber = c.String(),
                          PhoneNumberConfirmed = c.Boolean(nullable: false),
                          TwoFactorEnabled = c.Boolean(nullable: false),
                          LockoutEndDateUtc = c.DateTime(precision: 7, storeType: "datetime2"),
                          LockoutEnabled = c.Boolean(nullable: false),
                          AccessFailedCount = c.Int(nullable: false),
                          UserName = c.String(),
                      })
                  .PrimaryKey(t => t.UserId);
              
              CreateTable(
                  "dbo.UserClaim",
                  c => new
                      {
                          UserClaimId = c.Int(nullable: false, identity: true),
                          UserId = c.String(maxLength: 128),
                          ClaimType = c.String(),
                          ClaimValue = c.String(),
                      })
                  .PrimaryKey(t => t.UserClaimId)
                  .ForeignKey("dbo.User", t => t.UserId)
                  .Index(t => t.UserId);
              
              CreateTable(
                  "dbo.UserLogin",
                  c => new
                      {
                          LoginProvider = c.String(nullable: false, maxLength: 128),
                          ProviderKey = c.String(nullable: false, maxLength: 128),
                          UserId = c.String(nullable: false, maxLength: 128),
                      })
                  .PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
                  .ForeignKey("dbo.User", t => t.UserId, cascadeDelete: true)
                  .Index(t => t.UserId);
              
              CreateTable(
                  "dbo.UserProfiles",
                  c => new
                      {
                          Id = c.Int(nullable: false, identity: true),
                          FirstName = c.String(nullable: false),
                          LastName = c.String(nullable: false),
                          SecurityQuestion = c.String(),
                          SecurityAnswer = c.String(),
                          AccountEmail = c.String(),
                          IdentificationNumber = c.String(),
                          NotificationEmail = c.String(),
                          NotificationCellPhone = c.String(),
                          NotifcationPushMobile = c.String(),
                          NotifcationPushBrowser = c.String(),
                          CreateUser = c.String(nullable: false),
                          CreateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          LastUpdateUser = c.String(nullable: false),
                          LastUpdateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          SecurityUser_Id = c.String(nullable: false, maxLength: 128),
                      })
                  .PrimaryKey(t => t.Id)
                  .ForeignKey("dbo.User", t => t.SecurityUser_Id)
                  .Index(t => t.SecurityUser_Id);
              
              CreateTable(
                  "dbo.UserAddresses",
                  c => new
                      {
                          Id = c.Int(nullable: false, identity: true),
                          PrimaryMailing = c.Boolean(nullable: false),
                          PrimaryBilling = c.Boolean(nullable: false),
                          Type = c.Int(nullable: false),
                          Building = c.String(),
                          Development = c.String(),
                          OccupantName = c.String(),
                          Number = c.String(),
                          Street = c.String(),
                          XStreet1 = c.String(),
                          XStreet2 = c.String(),
                          County = c.String(),
                          Municipality = c.String(),
                          City = c.String(),
                          State = c.String(),
                          PostalCode = c.String(),
                          XCoordinate = c.Decimal(nullable: false, precision: 18, scale: 2),
                          YCoordinate = c.Decimal(nullable: false, precision: 18, scale: 2),
                          PlaceID = c.String(),
                          MapUrl = c.String(),
                          CreateUser = c.String(nullable: false),
                          CreateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          LastUpdateUser = c.String(nullable: false),
                          LastUpdateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          User_Id = c.Int(),
                      })
                  .PrimaryKey(t => t.Id)
                  .ForeignKey("dbo.UserProfiles", t => t.User_Id)
                  .Index(t => t.User_Id);
              
              CreateTable(
                  "dbo.UserMobileDevices",
                  c => new
                      {
                          Id = c.Int(nullable: false, identity: true),
                          MobileNumber = c.String(),
                          Carrier = c.Int(nullable: false),
                          EnablePush = c.Boolean(nullable: false),
                          EnableSMS = c.Boolean(nullable: false),
                          CreateUser = c.String(nullable: false),
                          CreateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          LastUpdateUser = c.String(nullable: false),
                          LastUpdateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          UserProfile_Id = c.Int(),
                      })
                  .PrimaryKey(t => t.Id)
                  .ForeignKey("dbo.UserProfiles", t => t.UserProfile_Id)
                  .Index(t => t.UserProfile_Id);
              
              CreateTable(
                  "dbo.UserMobileDeviceOrganizations",
                  c => new
                      {
                          Id = c.Int(nullable: false, identity: true),
                          CreateUser = c.String(nullable: false),
                          CreateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          LastUpdateUser = c.String(nullable: false),
                          LastUpdateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          Organization_Id = c.Int(),
                          UserDevice_Id = c.Int(),
                      })
                  .PrimaryKey(t => t.Id)
                  .ForeignKey("dbo.Organizations", t => t.Organization_Id)
                  .ForeignKey("dbo.UserMobileDevices", t => t.UserDevice_Id)
                  .Index(t => t.Organization_Id)
                  .Index(t => t.UserDevice_Id);
              
              CreateTable(
                  "dbo.Organizations",
                  c => new
                      {
                          Id = c.Int(nullable: false, identity: true),
                          Name = c.String(nullable: false),
                          Tag = c.String(nullable: false),
                          ContactPhone = c.String(nullable: false),
                          ContactFAX = c.String(),
                          ContactEmail = c.String(nullable: false),
                          Status = c.Int(nullable: false),
                          Type = c.Int(nullable: false),
                          CreateUser = c.String(nullable: false),
                          CreateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          LastUpdateUser = c.String(nullable: false),
                          LastUpdateDate = c.DateTime(nullable: false, precision: 7, storeType: "datetime2"),
                          BillingAddress_Id = c.Int(),
                          MailingAddress_Id = c.Int(),
                      })
                  .PrimaryKey(t => t.Id)
                  .ForeignKey("dbo.OrganizationAddresses", t => t.BillingAddress_Id)
                  .ForeignKey("dbo.OrganizationAddresses", t => t.MailingAddress_Id)
                  .Index(t => t.BillingAddress_Id)
                  .Index(t => t.MailingAddress_Id);
              
              CreateTable(
                  "dbo.OrganizationAddresses",
                  c => new
                      {
                          Id = c.Int(nullable: false, identity: true),
                          MailingAddress = c.Boolean(nullable: false),
                          BillingAddress = c.Boolean(nullable: false),
                          PrimaryMailing = c.Boolean(nullable: false),
                          PrimaryBilling = c.Boolean(nullable: false),
                          Type = c.Int(nullable: false),
                          Building = c.String(),
                          Development = c.String(),
                          OccupantName = c.String(),
                          Number = c.String(),
                          Street = c.String(),
                          XStreet1 = c.String(),
                          XStreet2 = c.String(),
                          County = c.String(),
                          Municipality = c.String(),
                          City = c.String(),
                          State = c.String(),
                          PostalCode = c.String(),
                          XCoordinate = c.Decimal(nullable: false, precision: 18, scale: 2),
                          YCoordinate = c.Decimal(nullable: false, precision: 18, scale: 2),
                          PlaceID = c.String(),
                          MapUrl = c.String(),
  
gt:                         CreateUser = c.String(nullable: false),