aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL/Resources/GridUserStore.migrations
blob: ecd3f4dbda896102fd15503706ec93e18a677bd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
:VERSION 1         # -------------------------- 

BEGIN TRANSACTION

CREATE TABLE "GridUser" (
    "UserID" VARCHAR(255) NOT NULL,
    "HomeRegionID" CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
    "HomePosition" CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    "HomeLookAt" CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    "LastRegionID" CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
    "LastPosition" CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    "LastLookAt" CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    "Online" CHAR(5) NOT NULL DEFAULT 'false',
    "Login" CHAR(16) NOT NULL DEFAULT '0',
    "Logout" CHAR(16) NOT NULL DEFAULT '0',
    PRIMARY KEY  ("UserID")
) 

COMMIT

:VERSION 2         # -------------------------- 

BEGIN TRANSACTION

CREATE TABLE [GridUser_tmp] (
    [UserID] VARCHAR(255) NOT NULL,
    [HomeRegionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
    [HomePosition] CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    [HomeLookAt] CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    [LastRegionID] uniqueidentifier NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
    [LastPosition] CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    [LastLookAt] CHAR(64) NOT NULL DEFAULT '<0,0,0>',
    [Online] CHAR(5) NOT NULL DEFAULT 'false',
    [Login] CHAR(16) NOT NULL DEFAULT '0',
    [Logout] CHAR(16) NOT NULL DEFAULT '0',
    
	  PRIMARY KEY CLUSTERED
		(
			[UserID] ASC
		)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
	) ON [PRIMARY]

COMMIT

IF EXISTS(SELECT * FROM dbo.GridUser)
	 EXEC('INSERT INTO dbo.GridUser_tmp ([UserID]
           ,[HomeRegionID]
           ,[HomePosition]
           ,[HomeLookAt]
           ,[LastRegionID]
           ,[LastPosition]
           ,[LastLookAt]
           ,[Online]
           ,[Login]
           ,[Logout])
		SELECT CONVERT(varchar(36), [HomeRegionID]), [HomePosition] ,[HomeLookAt] , CONVERT(varchar(36),[LastRegionID])
      ,[LastPosition]
      ,[LastLookAt]
      ,[Online]
      ,[Login]
      ,[Logout] FROM dbo.GridUser WITH (HOLDLOCK TABLOCKX)')

DROP TABLE dbo.GridUser

EXECUTE sp_rename N'dbo.GridUser_tmp', N'GridUser', 'OBJECT'