1 | USE [HeuristicLab.Hive-3.3]
|
---|
2 |
|
---|
3 | EXEC sp_configure filestream_access_level, 2
|
---|
4 | GO
|
---|
5 | RECONFIGURE
|
---|
6 | GO
|
---|
7 |
|
---|
8 | /**********************************************************/
|
---|
9 |
|
---|
10 | /* Move old Task Data */
|
---|
11 |
|
---|
12 | CREATE TABLE [dbo].[TaskDataTemp](
|
---|
13 | [TaskId] UniqueIdentifier RowGuidCol NOT NULL,
|
---|
14 | [Data] VarBinary(MAX) Filestream NOT NULL,
|
---|
15 | [LastUpdate] DateTime NOT NULL,
|
---|
16 | CONSTRAINT [PK_dbo.TaskDataTemp] PRIMARY KEY ([TaskId])
|
---|
17 | )
|
---|
18 |
|
---|
19 | INSERT INTO dbo.TaskDataTemp (TaskId, Data, LastUpdate)
|
---|
20 | SELECT TaskId, Data, LastUpdate
|
---|
21 | FROM dbo.TaskData
|
---|
22 |
|
---|
23 | DELETE FROM dbo.TaskData
|
---|
24 |
|
---|
25 | /* Alter TaskId and Data Column */
|
---|
26 |
|
---|
27 | ALTER TABLE dbo.TaskData
|
---|
28 | ALTER COLUMN [TaskId] ADD RowGuidCol
|
---|
29 |
|
---|
30 | ALTER TABLE dbo.TaskData
|
---|
31 | DROP COLUMN Data
|
---|
32 |
|
---|
33 | ALTER TABLE dbo.TaskData
|
---|
34 | ADD [Data] VarBinary(MAX) Filestream NOT NULL
|
---|
35 |
|
---|
36 | /* Insert data */
|
---|
37 |
|
---|
38 | INSERT INTO dbo.TaskData (TaskId, Data, LastUpdate)
|
---|
39 | SELECT TaskId, Data, LastUpdate
|
---|
40 | FROM dbo.TaskDataTemp
|
---|
41 |
|
---|
42 | DROP TABLE dbo.TaskDataTemp
|
---|
43 |
|
---|
44 |
|
---|
45 | /**********************************************************/
|
---|
46 |
|
---|
47 | /* Move old Plugin Data */
|
---|
48 |
|
---|
49 | CREATE TABLE [dbo].[PluginDataTemp](
|
---|
50 | [PluginDataId] UniqueIdentifier RowGuidCol NOT NULL,
|
---|
51 | [PluginId] UniqueIdentifier NOT NULL,
|
---|
52 | [Data] VarBinary(MAX) FileStream NOT NULL,
|
---|
53 | [FileName] VarChar(MAX) NOT NULL,
|
---|
54 | CONSTRAINT [PK_dbo.PluginDataTemp] PRIMARY KEY ([PluginDataId])
|
---|
55 | )
|
---|
56 |
|
---|
57 | INSERT INTO dbo.PluginDataTemp (PluginDataId, PluginId, Data, [FileName])
|
---|
58 | SELECT PluginDataId, PluginId, Data, [FileName]
|
---|
59 | FROM dbo.PluginData
|
---|
60 |
|
---|
61 | DELETE FROM dbo.PluginData
|
---|
62 |
|
---|
63 | /* Alter Data Column */
|
---|
64 |
|
---|
65 | ALTER TABLE dbo.PluginData
|
---|
66 | DROP COLUMN Data
|
---|
67 |
|
---|
68 | ALTER TABLE dbo.PluginData
|
---|
69 | ADD [Data] VarBinary(MAX) Filestream NOT NULL
|
---|
70 |
|
---|
71 | /* Insert data */
|
---|
72 |
|
---|
73 | INSERT INTO dbo.PluginData (PluginDataId, PluginId, Data, [FileName])
|
---|
74 | SELECT PluginDataId, PluginId, Data, [FileName]
|
---|
75 | FROM dbo.PluginDataTemp
|
---|
76 |
|
---|
77 | DROP TABLE dbo.PluginDataTemp |
---|