1 | /* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | use these DROP commands if you want to run this query a second time on the same db */
|
---|
5 | /*
|
---|
6 | ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId DROP ROWGUIDCOL;
|
---|
7 | ALTER TABLE dbo.Job ALTER COLUMN JobId DROP ROWGUIDCOL;
|
---|
8 | ALTER TABLE dbo.ClientConfig ALTER COLUMN ClientConfigId DROP ROWGUIDCOL;
|
---|
9 | ALTER TABLE dbo.ClientGroup_Resource ALTER COLUMN ClientGroup_RessourceId DROP ROWGUIDCOL;
|
---|
10 | ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId DROP ROWGUIDCOL;
|
---|
11 | ALTER TABLE dbo.Project ALTER COLUMN ProjectId DROP ROWGUIDCOL;
|
---|
12 | ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId DROP ROWGUIDCOL;
|
---|
13 | ALTER TABLE dbo.Resource ALTER COLUMN ResourceId DROP ROWGUIDCOL;
|
---|
14 | ALTER TABLE dbo.UptimeCalendar ALTER COLUMN UptimeCalendarId DROP ROWGUIDCOL;
|
---|
15 | ALTER TABLE dbo.UptimeStatistics ALTER COLUMN UptimeStatisticsId DROP ROWGUIDCOL;
|
---|
16 |
|
---|
17 | ALTER TABLE dbo.AssignedResources DROP CONSTRAINT [DF_AssignedResources_AssignedRessourcesId];
|
---|
18 | ALTER TABLE dbo.Job DROP CONSTRAINT [DF_Job_JobId];
|
---|
19 | ALTER TABLE dbo.ClientConfig DROP CONSTRAINT [DF_ClientConfig_ClientConfigId];
|
---|
20 | ALTER TABLE dbo.ClientGroup_Resource DROP CONSTRAINT [DF_ClientGroup_ResourceClientGroup_RessourceId];
|
---|
21 | ALTER TABLE dbo.PluginInfo DROP CONSTRAINT [DF_PluginInfo_PluginId];
|
---|
22 | ALTER TABLE dbo.Project DROP CONSTRAINT [DF_Project_ProjectId];
|
---|
23 | ALTER TABLE dbo.RequiredPlugins DROP CONSTRAINT [DF_RequiredPlugins_RequiredPluginId];
|
---|
24 | ALTER TABLE dbo.Resource DROP CONSTRAINT [DF_Resource_ResourceId];
|
---|
25 | ALTER TABLE dbo.UptimeCalendar DROP CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId];
|
---|
26 | ALTER TABLE dbo.UptimeStatistics DROP CONSTRAINT [DF_UptimeStatistics_UptimeStatisticsId];
|
---|
27 | */
|
---|
28 |
|
---|
29 |
|
---|
30 | ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId ADD ROWGUIDCOL;
|
---|
31 | ALTER TABLE dbo.AssignedResources WITH NOCHECK ADD CONSTRAINT [DF_AssignedResources_AssignedRessourcesId] DEFAULT (newid()) FOR AssignedRessourcesId;
|
---|
32 |
|
---|
33 | ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
|
---|
34 | ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR JobId;
|
---|
35 |
|
---|
36 | ALTER TABLE dbo.ClientConfig ALTER COLUMN ClientConfigId ADD ROWGUIDCOL;
|
---|
37 | ALTER TABLE dbo.ClientConfig WITH NOCHECK ADD CONSTRAINT [DF_ClientConfig_ClientConfigId] DEFAULT (newid()) FOR ClientConfigId;
|
---|
38 |
|
---|
39 | ALTER TABLE dbo.ClientGroup_Resource ALTER COLUMN ClientGroup_RessourceId ADD ROWGUIDCOL;
|
---|
40 | ALTER TABLE dbo.ClientGroup_Resource WITH NOCHECK ADD CONSTRAINT [DF_ClientGroup_Resource_ClientGroup_RessourceId] DEFAULT (newid()) FOR ClientGroup_RessourceId;
|
---|
41 |
|
---|
42 | ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId ADD ROWGUIDCOL;
|
---|
43 | ALTER TABLE dbo.PluginInfo WITH NOCHECK ADD CONSTRAINT [DF_PluginInfo_PluginId] DEFAULT (newid()) FOR PluginId;
|
---|
44 |
|
---|
45 | ALTER TABLE dbo.Project ALTER COLUMN ProjectId ADD ROWGUIDCOL;
|
---|
46 | ALTER TABLE dbo.Project WITH NOCHECK ADD CONSTRAINT [DF_Project_ProjectId] DEFAULT (newid()) FOR ProjectId;
|
---|
47 |
|
---|
48 | ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId ADD ROWGUIDCOL;
|
---|
49 | ALTER TABLE dbo.RequiredPlugins WITH NOCHECK ADD CONSTRAINT [DF_RequiredPlugins_RequiredPluginId] DEFAULT (newid()) FOR RequiredPluginId;
|
---|
50 |
|
---|
51 | ALTER TABLE dbo.Resource ALTER COLUMN ResourceId ADD ROWGUIDCOL;
|
---|
52 | ALTER TABLE dbo.Resource WITH NOCHECK ADD CONSTRAINT [DF_Resource_ResourceId] DEFAULT (newid()) FOR ResourceId;
|
---|
53 |
|
---|
54 | ALTER TABLE dbo.UptimeCalendar ALTER COLUMN UptimeCalendarId ADD ROWGUIDCOL;
|
---|
55 | ALTER TABLE dbo.UptimeCalendar WITH NOCHECK ADD CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId] DEFAULT (newid()) FOR UptimeCalendarId;
|
---|
56 |
|
---|
57 | ALTER TABLE dbo.UptimeStatistics ALTER COLUMN UptimeStatisticsId ADD ROWGUIDCOL;
|
---|
58 | ALTER TABLE dbo.UptimeStatistics WITH NOCHECK ADD CONSTRAINT [DF_UptimeStatistics_UptimeStatisticsId] DEFAULT (newid()) FOR UptimeStatisticsId;
|
---|
59 |
|
---|
60 | /* create indices */
|
---|
61 | CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId); |
---|