1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- :VERSION 1
- BEGIN TRANSACTION
- CREATE TABLE [Friends] (
- [PrincipalID] uniqueidentifier NOT NULL,
- [Friend] varchar(255) NOT NULL,
- [Flags] char(16) NOT NULL DEFAULT '0',
- [Offered] varchar(32) NOT NULL DEFAULT 0)
- ON [PRIMARY]
- COMMIT
- :VERSION 2
- BEGIN TRANSACTION
- IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[userfriends]') AND type in (N'U'))
- INSERT INTO Friends (PrincipalID, Friend, Flags, Offered)
- SELECT [ownerID], [friendID], [friendPerms], 0 FROM userfriends;
- COMMIT
- :VERSION 3
- BEGIN TRANSACTION
- CREATE TABLE [Tmp_Friends]
- ([PrincipalID] varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
- [Friend] varchar(255) NOT NULL,
- [Flags] char(16) NOT NULL DEFAULT '0',
- [Offered] varchar(32) NOT NULL DEFAULT 0)
- ON [PRIMARY]
- IF EXISTS(SELECT * FROM dbo.Friends)
- EXEC('INSERT INTO dbo.Tmp_Friends (PrincipalID, Friend, Flags, Offered)
- SELECT CONVERT(varchar(255),PrincipalID), Friend, Flags, Offered FROM dbo.Friends WITH (HOLDLOCK TABLOCKX)')
- DROP TABLE dbo.Friends
- EXECUTE sp_rename N'dbo.Tmp_Friends', N'Friends', 'OBJECT'
- ALTER TABLE dbo.Friends ADD
- PRIMARY KEY CLUSTERED
- (
- [PrincipalID] ASC, [Friend] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- COMMIT
|