Changeset 5106 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools
- Timestamp:
- 12/14/10 16:52:55 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs
r5078 r5106 21 21 22 22 using HeuristicLab.PluginInfrastructure; 23 using System.IO; 24 using System.Windows.Forms; 23 25 24 26 namespace HeuristicLab.Services.Hive.DataAccess { 25 [Application("Create Hive-3.4 Database", "Creates new empty Hive Database.", true)]27 [Application("Create Hive-3.4 Database", "Creates new empty Hive Database.", false)] 26 28 class CreateHiveDatabaseApplication : ApplicationBase { 27 29 … … 31 33 db.DeleteDatabase(); 32 34 db.CreateDatabase(); 35 using (var sr = new StreamReader("../../../../HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql")) { 36 var commands = sr.ReadToEnd().Split(new string[] {"GO\r"}, System.StringSplitOptions.RemoveEmptyEntries); 37 foreach (var cmd in commands) { 38 db.ExecuteCommand(cmd); 39 } 40 } 33 41 } 42 MessageBox.Show("Successfully created HeuristicLab.Hive-3.4 database."); 34 43 } 35 44 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/cleanHiveDatabase.sql
r4629 r5106 1 DELETE FROM [HeuristicLab.Hive ].[dbo].AssignedResources2 DELETE FROM [HeuristicLab.Hive ].[dbo].RequiredPlugins3 DELETE FROM [HeuristicLab.Hive ].[dbo].PluginInfo4 DELETE FROM [HeuristicLab.Hive ].[dbo].UptimeStatistics5 DELETE FROM [HeuristicLab.Hive ].[dbo].UptimeCalendar6 DELETE FROM [HeuristicLab.Hive ].[dbo].SlaveConfig7 DELETE FROM [HeuristicLab.Hive ].[dbo].SlaveGroup_Resource8 DELETE FROM [HeuristicLab.Hive ].[dbo].[Resource]9 DELETE FROM [HeuristicLab.Hive ].[dbo].HiveExperiment10 DELETE FROM [HeuristicLab.Hive ].[dbo].Job1 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].AssignedResources 2 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].RequiredPlugins 3 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].PluginData 4 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].Plugin 5 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].UptimeCalendar 6 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].SlaveGroup_Resource 7 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].[Resource] 8 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].HiveExperiment 9 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].JobData 10 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].Job 11 11 12 12 /** only jobs & experiments **/ 13 DELETE FROM [HeuristicLab.Hive].[dbo].AssignedResources 14 DELETE FROM [HeuristicLab.Hive].[dbo].RequiredPlugins 15 DELETE FROM [HeuristicLab.Hive].[dbo].PluginInfo 16 DELETE FROM [HeuristicLab.Hive].[dbo].HiveExperiment 17 DELETE FROM [HeuristicLab.Hive].[dbo].Job 13 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].AssignedResources 14 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].RequiredPlugins 15 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].PluginData 16 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].Plugin 17 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].HiveExperiment 18 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].JobData 19 DELETE FROM [HeuristicLab.Hive-3.4].[dbo].Job -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql
r4905 r5106 1 1 /* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */ 2 2 3 /* 4 use these DROP commands if you want to run this query a second time on the same db */ 3 /* use these DROP commands if you want to run this query a second time on the same db */ 4 5 5 /* 6 6 ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId DROP ROWGUIDCOL; 7 7 ALTER TABLE dbo.Job ALTER COLUMN JobId DROP ROWGUIDCOL; 8 ALTER TABLE dbo.SlaveConfig ALTER COLUMN SlaveConfigId DROP ROWGUIDCOL;9 8 ALTER TABLE dbo.SlaveGroup_Resource ALTER COLUMN SlaveGroup_RessourceId DROP ROWGUIDCOL; 10 9 ALTER TABLE dbo.Plugin ALTER COLUMN PluginId DROP ROWGUIDCOL; 11 ALTER TABLE dbo.Project ALTER COLUMN ProjectId DROP ROWGUIDCOL;12 10 ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId DROP ROWGUIDCOL; 13 11 ALTER TABLE dbo.Resource ALTER COLUMN ResourceId DROP ROWGUIDCOL; 14 12 ALTER TABLE dbo.UptimeCalendar ALTER COLUMN UptimeCalendarId DROP ROWGUIDCOL; 15 ALTER TABLE dbo.UptimeStatistics ALTER COLUMN UptimeStatisticsId DROP ROWGUIDCOL;16 13 ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId DROP ROWGUIDCOL; 17 14 18 15 ALTER TABLE dbo.AssignedResources DROP CONSTRAINT [DF_AssignedResources_AssignedRessourcesId]; 19 16 ALTER TABLE dbo.Job DROP CONSTRAINT [DF_Job_JobId]; 20 ALTER TABLE dbo.SlaveConfig DROP CONSTRAINT [DF_SlaveConfig_SlaveConfigId];21 17 ALTER TABLE dbo.SlaveGroup_Resource DROP CONSTRAINT [DF_SlaveGroup_ResourceSlaveGroup_RessourceId]; 22 18 ALTER TABLE dbo.Plugin DROP CONSTRAINT [DF_Plugin_PluginId]; 23 ALTER TABLE dbo.Project DROP CONSTRAINT [DF_Project_ProjectId];24 19 ALTER TABLE dbo.RequiredPlugins DROP CONSTRAINT [DF_RequiredPlugins_RequiredPluginId]; 25 20 ALTER TABLE dbo.Resource DROP CONSTRAINT [DF_Resource_ResourceId]; 26 21 ALTER TABLE dbo.UptimeCalendar DROP CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId]; 27 ALTER TABLE dbo.UptimeStatistics DROP CONSTRAINT [DF_UptimeStatistics_UptimeStatisticsId];28 22 ALTER TABLE dbo.HiveExperiment DROP CONSTRAINT [DF_HiveExperiment_HiveExperimentId]; 29 23 */ … … 47 41 ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR JobId; 48 42 49 ALTER TABLE dbo.SlaveConfig ALTER COLUMN SlaveConfigId ADD ROWGUIDCOL;50 ALTER TABLE dbo.SlaveConfig WITH NOCHECK ADD CONSTRAINT [DF_SlaveConfig_SlaveConfigId] DEFAULT (newid()) FOR SlaveConfigId;51 52 ALTER TABLE dbo.SlaveGroup_Resource ALTER COLUMN SlaveGroup_RessourceId ADD ROWGUIDCOL;53 ALTER TABLE dbo.SlaveGroup_Resource WITH NOCHECK ADD CONSTRAINT [DF_SlaveGroup_Resource_SlaveGroup_RessourceId] DEFAULT (newid()) FOR SlaveGroup_RessourceId;54 55 43 ALTER TABLE dbo.Plugin ALTER COLUMN PluginId ADD ROWGUIDCOL; 56 44 ALTER TABLE dbo.Plugin WITH NOCHECK ADD CONSTRAINT [DF_Plugin_PluginId] DEFAULT (newid()) FOR PluginId; 57 58 ALTER TABLE dbo.Project ALTER COLUMN ProjectId ADD ROWGUIDCOL;59 ALTER TABLE dbo.Project WITH NOCHECK ADD CONSTRAINT [DF_Project_ProjectId] DEFAULT (newid()) FOR ProjectId;60 45 61 46 ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId ADD ROWGUIDCOL; … … 81 66 ALTER TABLE dbo.UptimeCalendar ALTER COLUMN UptimeCalendarId ADD ROWGUIDCOL; 82 67 ALTER TABLE dbo.UptimeCalendar WITH NOCHECK ADD CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId] DEFAULT (newid()) FOR UptimeCalendarId; 83 84 ALTER TABLE dbo.UptimeStatistics ALTER COLUMN UptimeStatisticsId ADD ROWGUIDCOL;85 ALTER TABLE dbo.UptimeStatistics WITH NOCHECK ADD CONSTRAINT [DF_UptimeStatistics_UptimeStatisticsId] DEFAULT (newid()) FOR UptimeStatisticsId;86 68 87 69 ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId ADD ROWGUIDCOL; … … 137 119 END 138 120 121 DELETE JobData FROM JobData INNER JOIN #Table ON JobData.JobId = #Table.JobId 139 122 DELETE Job FROM Job INNER JOIN #Table ON Job.JobId = #Table.JobId 140 123 END
Note: See TracChangeset
for help on using the changeset viewer.