1
0

FriendsStore.migrations 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. :VERSION 1
  2. BEGIN TRANSACTION
  3. CREATE TABLE [Friends] (
  4. [PrincipalID] uniqueidentifier NOT NULL,
  5. [Friend] varchar(255) NOT NULL,
  6. [Flags] char(16) NOT NULL DEFAULT '0',
  7. [Offered] varchar(32) NOT NULL DEFAULT 0)
  8. ON [PRIMARY]
  9. COMMIT
  10. :VERSION 2
  11. BEGIN TRANSACTION
  12. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[userfriends]') AND type in (N'U'))
  13. INSERT INTO Friends (PrincipalID, Friend, Flags, Offered)
  14. SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends;
  15. COMMIT
  16. :VERSION 3
  17. BEGIN TRANSACTION
  18. CREATE TABLE [Tmp_Friends]
  19. ([PrincipalID] varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
  20. [Friend] varchar(255) NOT NULL,
  21. [Flags] char(16) NOT NULL DEFAULT '0',
  22. [Offered] varchar(32) NOT NULL DEFAULT 0)
  23. ON [PRIMARY]
  24. IF EXISTS(SELECT * FROM dbo.Friends)
  25. EXEC('INSERT INTO dbo.Tmp_Friends (PrincipalID, Friend, Flags, Offered)
  26. SELECT CONVERT(varchar(255),PrincipalID), Friend, Flags, Offered FROM dbo.Friends WITH (HOLDLOCK TABLOCKX)')
  27. DROP TABLE dbo.Friends
  28. EXECUTE sp_rename N'dbo.Tmp_Friends', N'Friends', 'OBJECT'
  29. ALTER TABLE dbo.Friends ADD
  30. PRIMARY KEY CLUSTERED
  31. (
  32. [PrincipalID] ASC, [Friend] ASC
  33. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  34. COMMIT