Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3.3-HiveMigration/tools/prepareHiveDatabase.sql @ 4159

Last change on this file since 4159 was 4159, checked in by cneumuel, 13 years ago

added sql-scripts for hive-database

File size: 3.8 KB
Line 
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 */
5ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId DROP ROWGUIDCOL;
6ALTER TABLE dbo.Job ALTER COLUMN JobId DROP ROWGUIDCOL;
7ALTER TABLE dbo.ClientConfig ALTER COLUMN ClientConfigId DROP ROWGUIDCOL;
8ALTER TABLE dbo.ClientGroup_Resource ALTER COLUMN ClientGroup_RessourceId DROP ROWGUIDCOL;
9ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId DROP ROWGUIDCOL;
10ALTER TABLE dbo.Project ALTER COLUMN ProjectId DROP ROWGUIDCOL;
11ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId DROP ROWGUIDCOL;
12ALTER TABLE dbo.Resource ALTER COLUMN ResourceId DROP ROWGUIDCOL;
13ALTER TABLE dbo.UptimeCalendar ALTER COLUMN UptimeCalendarId DROP ROWGUIDCOL;
14ALTER TABLE dbo.UptimeStatistics ALTER COLUMN UptimeStatisticsId DROP ROWGUIDCOL;
15
16ALTER TABLE dbo.AssignedResources DROP CONSTRAINT [DF_AssignedResources_AssignedRessourcesId];
17ALTER TABLE dbo.Job DROP CONSTRAINT [DF_Job_JobId];
18ALTER TABLE dbo.ClientConfig DROP CONSTRAINT [DF_ClientConfig_ClientConfigId];
19ALTER TABLE dbo.ClientGroup_Resource DROP CONSTRAINT [DF_ClientGroup_ResourceClientGroup_RessourceId];
20ALTER TABLE dbo.PluginInfo DROP CONSTRAINT [DF_PluginInfo_PluginId];
21ALTER TABLE dbo.Project DROP CONSTRAINT [DF_Project_ProjectId];
22ALTER TABLE dbo.RequiredPlugins DROP CONSTRAINT [DF_RequiredPlugins_RequiredPluginId];
23ALTER TABLE dbo.Resource DROP CONSTRAINT [DF_Resource_ResourceId];
24ALTER TABLE dbo.UptimeCalendar DROP CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId];
25ALTER TABLE dbo.UptimeStatistics DROP CONSTRAINT [DF_UptimeStatistics_UptimeStatisticsId];
26*/
27
28ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId ADD ROWGUIDCOL;
29ALTER TABLE dbo.AssignedResources WITH NOCHECK ADD CONSTRAINT [DF_AssignedResources_AssignedRessourcesId] DEFAULT (newid()) FOR AssignedRessourcesId;
30
31ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
32ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR JobId;
33
34ALTER TABLE dbo.ClientConfig ALTER COLUMN ClientConfigId ADD ROWGUIDCOL;
35ALTER TABLE dbo.ClientConfig WITH NOCHECK ADD CONSTRAINT [DF_ClientConfig_ClientConfigId] DEFAULT (newid()) FOR ClientConfigId;
36
37ALTER TABLE dbo.ClientGroup_Resource ALTER COLUMN ClientGroup_RessourceId ADD ROWGUIDCOL;
38ALTER TABLE dbo.ClientGroup_Resource WITH NOCHECK ADD CONSTRAINT [DF_ClientGroup_Resource_ClientGroup_RessourceId] DEFAULT (newid()) FOR ClientGroup_RessourceId;
39
40ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId ADD ROWGUIDCOL;
41ALTER TABLE dbo.PluginInfo WITH NOCHECK ADD CONSTRAINT [DF_PluginInfo_PluginId] DEFAULT (newid()) FOR PluginId;
42
43ALTER TABLE dbo.Project ALTER COLUMN ProjectId ADD ROWGUIDCOL;
44ALTER TABLE dbo.Project WITH NOCHECK ADD CONSTRAINT [DF_Project_ProjectId] DEFAULT (newid()) FOR ProjectId;
45
46ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId ADD ROWGUIDCOL;
47ALTER TABLE dbo.RequiredPlugins WITH NOCHECK ADD CONSTRAINT [DF_RequiredPlugins_RequiredPluginId] DEFAULT (newid()) FOR RequiredPluginId;
48
49ALTER TABLE dbo.Resource ALTER COLUMN ResourceId ADD ROWGUIDCOL;
50ALTER TABLE dbo.Resource WITH NOCHECK ADD CONSTRAINT [DF_Resource_ResourceId] DEFAULT (newid()) FOR ResourceId;
51
52ALTER TABLE dbo.UptimeCalendar ALTER COLUMN UptimeCalendarId ADD ROWGUIDCOL;
53ALTER TABLE dbo.UptimeCalendar WITH NOCHECK ADD CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId] DEFAULT (newid()) FOR UptimeCalendarId;
54
55ALTER TABLE dbo.UptimeStatistics ALTER COLUMN UptimeStatisticsId ADD ROWGUIDCOL;
56ALTER TABLE dbo.UptimeStatistics WITH NOCHECK ADD CONSTRAINT [DF_UptimeStatistics_UptimeStatisticsId] DEFAULT (newid()) FOR UptimeStatisticsId;
57
58/* create indices */
59CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId);
Note: See TracBrowser for help on using the repository browser.