
IF OBJECT_ID('dbo.webpages_OAuthMembership', 'U') IS NOT NULL
    DROP TABLE [dbo].[webpages_OAuthMembership]
IF OBJECT_ID('dbo.webpages_UsersInRoles', 'U') IS NOT NULL
    DROP TABLE [dbo].[webpages_UsersInRoles]
IF OBJECT_ID('dbo.webpages_Roles', 'U') IS NOT NULL
    DROP TABLE [dbo].[webpages_Roles]
IF OBJECT_ID('dbo.webpages_Membership', 'U') IS NOT NULL
    DROP TABLE [dbo].[webpages_Membership]
CREATE TABLE [dbo].[AccountTemp] (
    [AccountId] [nvarchar](128),
    [StoreId] [nvarchar](128),
    [MemberId] [nvarchar](64),
    [UserName] [nvarchar](128) NOT NULL,
    [RegisterType] [int] NOT NULL,
    [AccountState] [int] NOT NULL,
    [LastModified] [datetime],
    [Created] [datetime],
    [Discriminator] [nvarchar](128),
    CONSTRAINT [PK_dbo.AccountTemp] PRIMARY KEY ([AccountId])
)
INSERT INTO dbo.AccountTemp SELECT * FROM dbo.Account
IF object_id(N'[dbo].[FK_dbo.RoleAssignment_dbo.Account_AccountId]', N'F') IS NOT NULL
    ALTER TABLE [dbo].[RoleAssignment] DROP CONSTRAINT [FK_dbo.RoleAssignment_dbo.Account_AccountId]
IF EXISTS (SELECT name FROM sys.indexes WHERE name = N'IX_AccountId' AND object_id = object_id(N'[dbo].[RoleAssignment]', N'U'))
    DROP INDEX [IX_AccountId] ON [dbo].[RoleAssignment]
ALTER TABLE [dbo].[RoleAssignment] ALTER COLUMN [AccountId] [nvarchar](128) NOT NULL
DROP TABLE [dbo].[Account]
EXECUTE sp_rename @objname = N'AccountTemp', @newname = N'Account', @objtype = N'OBJECT'
IF object_id('[PK_AccountTemp]') IS NOT NULL BEGIN
    EXECUTE sp_rename @objname = N'[PK_AccountTemp]', @newname = N'PK_Account', @objtype = N'OBJECT'
END
CREATE INDEX [IX_AccountId] ON [dbo].[RoleAssignment]([AccountId])
ALTER TABLE [dbo].[RoleAssignment] ADD CONSTRAINT [FK_dbo.RoleAssignment_dbo.Account_AccountId] FOREIGN KEY ([AccountId]) REFERENCES [dbo].[Account] ([AccountId]) ON DELETE CASCADE
INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
VALUES (N'201411061448001_AccountIdToString', N'VCF.Security',  0x1F8B0800000000000400ED5CCD6EE4B811BE07C83B083A06DE96ED49161BA37B17DEB6BD30321E0FDC9E416E035A62B7894854AF4419EE0479B23DEC23E51552FA97F823516A754B9E9DCB605A223F168B5F158B5495FFF7DBEFF39F5E3DD778C141487CBA30CF66A7A681A9ED3B846E1666C4D6DFFD60FEF4E39FFF34BF76BC57E373DEEE5DDC0E7AD270613E33B6BDB0ACD07EC61E0A671EB1033FF4D76C66FB9E851CDF3A3F3DFDBB75766661803001CB30E60F1165C4C3C90FF8B9F4A98DB72C42EE9DEF6037CC9EC39B55826A7C401E0EB7C8C60BF3330998BFF43D0F07369EDDF811751003A1665788A1D90ADB5140D8CE342E5D8240BA1576D7A68128F559D2ECE25388572CF0E966B58507C87DDC6D31B45B2337C4D99C2ECAE6BAD33B3D8FA767951D73283B0A99EF75043C7B97E9CBE2BBF7D2BA59E813347A0D9A67BB78D6895617E6471C78240C13707EB88BA51BC44D1BD49E6B7C962CDDAC443B31547D4E0A229DCDCE804AB3D3136319B92C0AF082E28805C83D313E464F2EB1FF81778FFEBF305DD0C875ABF38099C0BBDA0378F431F0B73860BB07BC166677EB98865547B078880240DA3BD504B0078CC334EED0EB7B4C37EC19CCE6FC07D3B821AFD8C99F6474FA4409D812746241043F3FC024D0938B8BF756E3E8F1BF0DA39EFFEDFB438CFA1E850CD692AC092EE60CB6851F89D7DA77196068D9DEED037A219B840B1CC083EFE252E9A1693C603769173E936D6ACDB37A9B2F55FEDE04BE17BFE6812A8DBE3CA260831988E8B7B55CF91110B72EFCDC2A0DA8D1ACEAB04398561D711AE65597A98F8989084AC27FFFD743F03D16608461C7752DA31A79D52C86B7EFDC6ADBED3BF7045D9C938EC4693BA5ACF1CF3629933632F93AF99FA1BCCE747C4D5F0F338281B7ECDE5FA361C79ABE04026FA8872953EFDE651BA9AD70AFA53B36DF46B6570F1C68E898754B70A114B5935997731FCAC04BC4E9987A29535FA3AF231CD9FCEF830DA2E4DF89EA8618BE79B44BDB86856A9EE7813CCE48EE75544797A95BEA35B2775F0467587A0E4513C17BA8DAF5717643396359E0A272D8BD3C5CA1DBFD5D5B06350D9F5631D1AECE6C44EB5E313F68366FDD819BC7B9C3DE130E0EEF283F85381827327BC01B12329C50381FFD96B277E79D91323AACC02CF6449A7CB4B88733E51D559BD3D57156D0CFB74922A4348EAC1E56EB5AB8A68EA17D724D992986A04053704E640BEE08845B987F1194AD334CB1CB94C3A887383379CF764FAFB08B19362EEDF4427B89421B39E2C2830E9DFA1370863800A513E42E6199C1BD12CA44CF49A84DB6C8D59D0807D0F91A3816B518947F7385B7983A20B3EEEA0D214D3128A7D036FDCDAD0A419B79AB322C159D5AADAC2453B1811F9049ED824958CE9F9DDA8CA9175D5B14A5430F65A4D089A92D8AD95B90239054169E36F93B65ACDA9F03CD032848364D27AA105E8708F2ABB7CE8E53B13EFB4970241EF217419AFB6E130F07D9D8DF1E0F15C21F91878AF599180FD31014FA30E881834C80EB9BFC90FB80B77E48E07CB6939C95E19C931D97C3ECBCC2F329065F61268424105C97C1AF243E14885907122E5605309EFA1A802A18ADCEB5738314A6BA21B400665BA20CA9887B3888CAF2AAD454FBC85569DFFA458C67619763463135C9A209F4EE72B0A8003780D6780F8D3594A63C0D8A2AD38A6F3B45B89559952468D0535B60CAA9BF369FBD3525BDD89313AB31C0D20EB1F467A31D54719043A945F8A2D36A6F1A6A51EDF8C3D8D8506AC9AF358A3DA57837B7D24CBBECC1DC52A4E4CDEFD0764BE8A692A2973D3156697EDEF2BB55F724352FC5B0EC5092AB56485B8C047B1EDA60EE2D0C0D92DE902064712AE0138AAFBF968E273493EEA00AAF9F0F296E92E2E2E5DB41DE27FE7FDA4F2F6771A6F6EBA59A6F60E6B1A9244AC0524F2B7636E2444AE4A2A0310765E9BB9147756E28D488E9D56A15297DA28F50BF92AC22D5DFE82316179555B0E2A11407D8E290E400F019B911AEA7AC5461AE486807C42314C172C8C0E616B77042DC28104708BCEB5CD4622AEF6C0EC0562E8CEBCED83600D57AD6FBF1CC15DFEA33250FEE79BC6E28C35BD5346D828FE3DF8A5D1CCC1A7ADA4037E6EFCFCFAFD547A7D1DC5B6161F3A164103E568EB5FD98D904D0C4D17AE20DCFD6A6C49E26643EA3A68ACBBFD347ADDC7157011BAEBE9BE7BEBF7D4ED7BAAAF7246FC1CE8A73FA010C2CBFEDE96E59CA9EC7A06891CF51452A1EEAE394F91A55A0F2A93E52999151452A9F7630BF5A8645CD086B6F3A3B872CD342A2FCECCD5B37EEE2EA723A562DDC55F04D8AD18B3B0BEE6E629EDD13B4D7140A17076913D30055BF1027BE3458ED803F5EE6037E75972E49BC60DEE00E769F350E599A22669E9F9E9D732588D32907B4C2D07125F72CF29AC0FA8A8D5473475F50603FA340CCD3DA23295F0A9A14D50D9045057B0666493A5409A6939FC66555F585E16C575F8B2278DF8AB71EC4693BBBF7AF26934E3D4E28DC2BD9B94415BEBFDD5207BF2ECCFF24FD2E8CDB7F7E49BB9E18F701F88B0BE3D4F8EFBEC2344F5443A42A8052B03E66F6CD220AB68C57E93414E75B7DE63786ECC510D5297BEC5299A1F823AF84D140EF55F8D2C90116BD07F57E93DA24BE195A952763176E0CE63FB9BA8C7EDA1361F9328C81AC94AFBA184C0DB2A20A121FCC0628A9E883F3C7B4B621CA22AA5F928E5F99A04ABDD82B67B3578664E327D5A315367CE5650C23D62BF0F7E823D5271CB110A1F553D4DB2F3C386EE6F574C8A4F8EA7D840282A9256BEF5F34302687C6DCF08ECDA18E9BDCE809FF625623BF92AA4CFE9644FEF4230704964F3EAC7A1AF3F54EF4D7C8F3978DD7A31640590AA0C2EF5824A05123A01AA97B1D415319816C9469D51888CBCFA7A2EA273937E44ABF91CA0159894087E4F7861CFA29170408624F6ACA0749F6EF3EE5A169DE21915FFC080E3B54E5CFEFC21E19EBBC8088930328B66B7B53D1E696AEFD7C8BE424CA9B08174A0C39B0715D068CAC91CDE0B58D61BAF1DFDCC8920FAEBD27ECDCD2FB886D230653C6DE93BBAB2A23DE6A9BC64FAA15EA32CFEFB7C95F9218620A2026892F5FEEE9CF11719D42EE1BF142480511EFE1BF60789EAE2584040C6F7605D2079F6A0265EA2B428F47EC6D5D000BEFE90ABDE03EB27D0AF17BBC41F62ECF655083B42F445DEDF32B823601F2C20CA3EC0F3F81C38EF7FAE3FF016254D509855A0000 , N'6.1.1-30610')

