This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DatabaseMigrator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="DatabaseMigrator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup>
<applicationSettings>
<DatabaseMigrator.Properties.Settings>
<setting name="LocalDbDataPROInstance" serializeAs="String">
<value>(localdb)\DataPROInstance</value>
</setting>
<setting name="StopDataProInstance" serializeAs="String">
<value>stop DataPROInstance</value>
</setting>
<setting name="Warning" serializeAs="String">
<value>Warning</value>
</setting>
<setting name="DeleteDataProInstance" serializeAs="String">
<value>delete DataPROInstance</value>
</setting>
<setting name="CreateDataProInstance" serializeAs="String">
<value>create DataPROInstance</value>
</setting>
<setting name="StartDataProInstance" serializeAs="String">
<value>start DataPROInstance</value>
</setting>
<setting name="LocalDbFolder" serializeAs="String">
<value>db</value>
</setting>
<setting name="DataPRO" serializeAs="String">
<value>DataPRO</value>
</setting>
<setting name="ISO" serializeAs="String">
<value>ISO</value>
</setting>
<setting name="Mdf" serializeAs="String">
<value>.mdf</value>
</setting>
<setting name="LogLdf" serializeAs="String">
<value>_log.ldf</value>
</setting>
<setting name="SqlServerLocalDbNotInstalled" serializeAs="String">
<value>SQL Server LocalDb is not installed.</value>
</setting>
<setting name="SqlLocalDBExe" serializeAs="String">
<value>SqlLocalDB.exe</value>
</setting>
<setting name="ScriptsFolder" serializeAs="String">
<value>SQL Server Scripts</value>
</setting>
<setting name="AttachDBsbat" serializeAs="String">
<value>AttachDBs.bat</value>
</setting>
<setting name="RegistrySoftwareMicrosoftMicrosoftSQLServerLocalDBInstalledVersions" serializeAs="String">
<value>SOFTWARE\\Microsoft\\Microsoft SQL Server Local DB\\Installed Versions</value>
</setting>
<setting name="InstanceAPIPath" serializeAs="String">
<value>InstanceAPIPath</value>
</setting>
<setting name="SqlUserInstanceDll" serializeAs="String">
<value>SqlUserInstance.dll</value>
</setting>
<setting name="LocalDB" serializeAs="String">
<value>LocalDB</value>
</setting>
<setting name="Tools" serializeAs="String">
<value>Tools</value>
</setting>
<setting name="Db" serializeAs="String">
<value>.db</value>
</setting>
<setting name="SameVersionDatabase" serializeAs="String">
<value>Database is already version {0} - no migration needed.</value>
</setting>
<setting name="ActionRequired" serializeAs="String">
<value>Action required</value>
</setting>
<setting name="CurrentVersionGreater" serializeAs="String">
<value>The current database version ({0}) is greater than what is requested. Downward migration is not available.</value>
</setting>
<setting name="DatabaseMigrationFailed" serializeAs="String">
<value>Database migration has failed.{0}Previous version of DataPRO must be used. Please contact DTS Support.</value>
</setting>
</DatabaseMigrator.Properties.Settings>
</applicationSettings>
<userSettings>
<DatabaseMigrator.Properties.Settings>
<setting name="DatabaseMigrationSucceeded" serializeAs="String">
<value>Database has been migrated from version {0} to {1}.</value>
</setting>
<setting name="WarningAllowStreamingModesWasNotMigrated" serializeAs="String">
<value>Warning: The AllowStreaming config setting was not migrated and has been set to False.{0}{0}An "Allow streaming modes" checkbox is now in the "Test setup settings" step of the "System Settings" tab.</value>
</setting>
<setting name="CreatingBackupDb" serializeAs="String">
<value>Creating a backup database...</value>
</setting>
</DatabaseMigrator.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -0,0 +1,291 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DatabaseMigrator.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("(localdb)\\DataPROInstance")]
public string LocalDbDataPROInstance {
get {
return ((string)(this["LocalDbDataPROInstance"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("stop DataPROInstance")]
public string StopDataProInstance {
get {
return ((string)(this["StopDataProInstance"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Warning")]
public string Warning {
get {
return ((string)(this["Warning"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("delete DataPROInstance")]
public string DeleteDataProInstance {
get {
return ((string)(this["DeleteDataProInstance"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("create DataPROInstance")]
public string CreateDataProInstance {
get {
return ((string)(this["CreateDataProInstance"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("start DataPROInstance")]
public string StartDataProInstance {
get {
return ((string)(this["StartDataProInstance"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("db")]
public string LocalDbFolder {
get {
return ((string)(this["LocalDbFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("DataPRO")]
public string DataPRO {
get {
return ((string)(this["DataPRO"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("ISO")]
public string ISO {
get {
return ((string)(this["ISO"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(".mdf")]
public string Mdf {
get {
return ((string)(this["Mdf"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("_log.ldf")]
public string LogLdf {
get {
return ((string)(this["LogLdf"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SQL Server LocalDb is not installed.")]
public string SqlServerLocalDbNotInstalled {
get {
return ((string)(this["SqlServerLocalDbNotInstalled"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SqlLocalDB.exe")]
public string SqlLocalDBExe {
get {
return ((string)(this["SqlLocalDBExe"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SQL Server Scripts")]
public string ScriptsFolder {
get {
return ((string)(this["ScriptsFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("AttachDBs.bat")]
public string AttachDBsbat {
get {
return ((string)(this["AttachDBsbat"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SOFTWARE\\\\Microsoft\\\\Microsoft SQL Server Local DB\\\\Installed Versions")]
public string RegistrySoftwareMicrosoftMicrosoftSQLServerLocalDBInstalledVersions {
get {
return ((string)(this["RegistrySoftwareMicrosoftMicrosoftSQLServerLocalDBInstalledVersions"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("InstanceAPIPath")]
public string InstanceAPIPath {
get {
return ((string)(this["InstanceAPIPath"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SqlUserInstance.dll")]
public string SqlUserInstanceDll {
get {
return ((string)(this["SqlUserInstanceDll"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("LocalDB")]
public string LocalDB {
get {
return ((string)(this["LocalDB"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Tools")]
public string Tools {
get {
return ((string)(this["Tools"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(".db")]
public string Db {
get {
return ((string)(this["Db"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Database is already version {0} - no migration needed.")]
public string SameVersionDatabase {
get {
return ((string)(this["SameVersionDatabase"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Action required")]
public string ActionRequired {
get {
return ((string)(this["ActionRequired"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("The current database version ({0}) is greater than what is requested. Downward m" +
"igration is not available.")]
public string CurrentVersionGreater {
get {
return ((string)(this["CurrentVersionGreater"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Database migration has failed.{0}Previous version of DataPRO must be used. Pleas" +
"e contact DTS Support.")]
public string DatabaseMigrationFailed {
get {
return ((string)(this["DatabaseMigrationFailed"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Database has been migrated from version {0} to {1}.")]
public string DatabaseMigrationSucceeded {
get {
return ((string)(this["DatabaseMigrationSucceeded"]));
}
set {
this["DatabaseMigrationSucceeded"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Warning: The AllowStreaming config setting was not migrated and has been set to F" +
"alse.{0}{0}An \"Allow streaming modes\" checkbox is now in the \"Test setup setting" +
"s\" step of the \"System Settings\" tab.")]
public string WarningAllowStreamingModesWasNotMigrated {
get {
return ((string)(this["WarningAllowStreamingModesWasNotMigrated"]));
}
set {
this["WarningAllowStreamingModesWasNotMigrated"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Creating a backup database...")]
public string CreatingBackupDb {
get {
return ((string)(this["CreatingBackupDb"]));
}
set {
this["CreatingBackupDb"] = value;
}
}
}
}

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{14D2B644-AC7A-4D21-A826-198EE1BC25F7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DatabaseMigrator</RootNamespace>
<AssemblyName>DatabaseMigrator</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MigrateDatabase.cs" />
<Compile Include="MigrationForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MigrationForm.Designer.cs">
<DependentUpon>MigrationForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MigrationForm.resx">
<DependentUpon>MigrationForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
<Project>{e3be457c-0ac7-4a9c-bc81-eafeb3217878}</Project>
<Name>DTS.Common.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Common\DTS.Common\DTS.Common.csproj">
<Project>{f7a0804f-61a4-40ae-83d0-f1137622b592}</Project>
<Name>DTS.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy /y "$(SolutionDir)\..\DataPRO\Modules\Database\DatabaseMigrationScripts\bin\x64\Debug\DatabaseMigrationScripts.dll"
copy /y "$(SolutionDir)\..\Common\DTS.Common.Storage\AttachDBs.bat"</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,90 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="DatabaseMigrator.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="LocalDbDataPROInstance" Type="System.String" Scope="Application">
<Value Profile="(Default)">(localdb)\DataPROInstance</Value>
</Setting>
<Setting Name="StopDataProInstance" Type="System.String" Scope="Application">
<Value Profile="(Default)">stop DataPROInstance</Value>
</Setting>
<Setting Name="Warning" Type="System.String" Scope="Application">
<Value Profile="(Default)">Warning</Value>
</Setting>
<Setting Name="DeleteDataProInstance" Type="System.String" Scope="Application">
<Value Profile="(Default)">delete DataPROInstance</Value>
</Setting>
<Setting Name="CreateDataProInstance" Type="System.String" Scope="Application">
<Value Profile="(Default)">create DataPROInstance</Value>
</Setting>
<Setting Name="StartDataProInstance" Type="System.String" Scope="Application">
<Value Profile="(Default)">start DataPROInstance</Value>
</Setting>
<Setting Name="LocalDbFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)">db</Value>
</Setting>
<Setting Name="DataPRO" Type="System.String" Scope="Application">
<Value Profile="(Default)">DataPRO</Value>
</Setting>
<Setting Name="ISO" Type="System.String" Scope="Application">
<Value Profile="(Default)">ISO</Value>
</Setting>
<Setting Name="Mdf" Type="System.String" Scope="Application">
<Value Profile="(Default)">.mdf</Value>
</Setting>
<Setting Name="LogLdf" Type="System.String" Scope="Application">
<Value Profile="(Default)">_log.ldf</Value>
</Setting>
<Setting Name="SqlServerLocalDbNotInstalled" Type="System.String" Scope="Application">
<Value Profile="(Default)">SQL Server LocalDb is not installed.</Value>
</Setting>
<Setting Name="SqlLocalDBExe" Type="System.String" Scope="Application">
<Value Profile="(Default)">SqlLocalDB.exe</Value>
</Setting>
<Setting Name="ScriptsFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)">SQL Server Scripts</Value>
</Setting>
<Setting Name="AttachDBsbat" Type="System.String" Scope="Application">
<Value Profile="(Default)">AttachDBs.bat</Value>
</Setting>
<Setting Name="RegistrySoftwareMicrosoftMicrosoftSQLServerLocalDBInstalledVersions" Type="System.String" Scope="Application">
<Value Profile="(Default)">SOFTWARE\\Microsoft\\Microsoft SQL Server Local DB\\Installed Versions</Value>
</Setting>
<Setting Name="InstanceAPIPath" Type="System.String" Scope="Application">
<Value Profile="(Default)">InstanceAPIPath</Value>
</Setting>
<Setting Name="SqlUserInstanceDll" Type="System.String" Scope="Application">
<Value Profile="(Default)">SqlUserInstance.dll</Value>
</Setting>
<Setting Name="LocalDB" Type="System.String" Scope="Application">
<Value Profile="(Default)">LocalDB</Value>
</Setting>
<Setting Name="Tools" Type="System.String" Scope="Application">
<Value Profile="(Default)">Tools</Value>
</Setting>
<Setting Name="Db" Type="System.String" Scope="Application">
<Value Profile="(Default)">.db</Value>
</Setting>
<Setting Name="SameVersionDatabase" Type="System.String" Scope="Application">
<Value Profile="(Default)">Database is already version {0} - no migration needed.</Value>
</Setting>
<Setting Name="ActionRequired" Type="System.String" Scope="Application">
<Value Profile="(Default)">Action required</Value>
</Setting>
<Setting Name="CurrentVersionGreater" Type="System.String" Scope="Application">
<Value Profile="(Default)">The current database version ({0}) is greater than what is requested. Downward migration is not available.</Value>
</Setting>
<Setting Name="DatabaseMigrationFailed" Type="System.String" Scope="Application">
<Value Profile="(Default)">Database migration has failed.{0}Previous version of DataPRO must be used. Please contact DTS Support.</Value>
</Setting>
<Setting Name="DatabaseMigrationSucceeded" Type="System.String" Scope="User">
<Value Profile="(Default)">Database has been migrated from version {0} to {1}.</Value>
</Setting>
<Setting Name="WarningAllowStreamingModesWasNotMigrated" Type="System.String" Scope="User">
<Value Profile="(Default)">Warning: The AllowStreaming config setting was not migrated and has been set to False.{0}{0}An "Allow streaming modes" checkbox is now in the "Test setup settings" step of the "System Settings" tab.</Value>
</Setting>
<Setting Name="CreatingBackupDb" Type="System.String" Scope="User">
<Value Profile="(Default)">Creating a backup database...</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -0,0 +1,498 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DatabaseMigrator.Properties;
using DTS.Common.Storage;
using Microsoft.Win32;
using DTS.Common.Enums;
namespace DatabaseMigrator
{
public partial class MigrationForm : Form
{
public MigrationForm(string targetDir)
{
InitializeComponent();
_targetDir = targetDir;
}
private readonly string _targetDir;
private int _desiredDatabaseVersion;
private bool localDataExists = false;
private bool localSQLiteDataExists = false;
private bool localSQLLocalDbDataExists = false;
private void buttonOK_Click(object sender, EventArgs e)
{
SetMigrationStatus("Querying database version...");
var currentDatabaseVersion = GetDatabaseVersion(true); //fix this rbLocal.Checked);
if (currentDatabaseVersion == _desiredDatabaseVersion)
{
MessageBox.Show(string.Format(Settings.Default.SameVersionDatabase, currentDatabaseVersion), Settings.Default.ActionRequired, MessageBoxButtons.OK,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
}
else if (currentDatabaseVersion > _desiredDatabaseVersion)
{
MessageBox.Show(string.Format(Settings.Default.CurrentVersionGreater, currentDatabaseVersion), Settings.Default.ActionRequired, MessageBoxButtons.OK,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
}
else
{
SetMigrationStatus("Creating a backup database prior to migration...");
//Make a backup copy
CopyLocalDB();
DbOperations.Connection.DbVersion = currentDatabaseVersion;
//Migrate the database
SetMigrationStatus("Migrating database from verion " + currentDatabaseVersion + " to " + _desiredDatabaseVersion + "...");
try
{
MigrationResult result = DbOperations.Connection.UpgradeVersionsIfNeeded(_desiredDatabaseVersion, SetStatus, "DataPRO", "previousdir", "targetdir", "DataPRO.exe", "applicationSettings" /*fix this*/); //handle exceptions and display error
if (result != MigrationResult.OK)
{
ConvertResultAndDisplay(result);
}
MessageBox.Show(string.Format(Settings.Default.DatabaseMigrationSucceeded, currentDatabaseVersion, _desiredDatabaseVersion), Settings.Default.ActionRequired, MessageBoxButtons.OK,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
}
catch (Exception)
{
MessageBox.Show(string.Format(Settings.Default.DatabaseMigrationFailed, Environment.NewLine + Environment.NewLine), Settings.Default.ActionRequired, MessageBoxButtons.OK,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
}
}
Close();
}
private void ConvertResultAndDisplay(MigrationResult result)
{
string stringResult = ConvertMigrationResultToSetting(result);
MessageBox.Show(stringResult, Settings.Default.ActionRequired, MessageBoxButtons.OK,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
}
private string ConvertMigrationResultToSetting(MigrationResult result)
{
var stringResult = string.Empty;
switch (result)
{
case MigrationResult.OK:
break;
case MigrationResult.ExceptionThrown:
break;
case MigrationResult.WarningAllowStreamingModesWasNotMigrated:
stringResult = string.Format(Settings.Default.WarningAllowStreamingModesWasNotMigrated, Environment.NewLine, Environment.NewLine);
break;
}
return stringResult;
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Close();
}
private string InstallDatabase()
{
DbOperations._usingCentralizedDB = false;
DbOperations._usingMSSQL = true;
DbOperations.Connection.Server = Settings.Default.LocalDbDataPROInstance;
DbOperations._usingNTLMAuthentication = true;
var resultString = ProcessSqlLocalDbCommand(Settings.Default.StopDataProInstance);
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning, MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
resultString = ProcessSqlLocalDbCommand(Settings.Default.DeleteDataProInstance);
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning, MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
resultString = ProcessSqlLocalDbCommand(Settings.Default.CreateDataProInstance);
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning, MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
resultString = ProcessSqlLocalDbCommand(Settings.Default.StartDataProInstance);
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning, MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
//Attach the DataPRO database
var dbFileName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, DbOperations.Connection.DBName) + ".mdf";
var logFileName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, DbOperations.Connection.DBName) + "_log.ldf";
resultString = AttachDatabase(_targetDir, Settings.Default.DataPRO, dbFileName, logFileName);
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning, MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
//Attach the ISO database
dbFileName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, Settings.Default.ISO) + ".mdf";
logFileName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, Settings.Default.ISO) + "_log.ldf";
resultString = AttachDatabase(_targetDir, Settings.Default.ISO, dbFileName, logFileName);
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning, MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
return resultString;
}
private void SetMigrationStatus(string migrationStatus)
{
//Remove the previous status
SetStatus(string.Empty);
MigrationStatusLabel.Text = migrationStatus;
MigrationStatusLabel.Refresh();
}
private void SetStatus(string status, bool output = false)
{
statusTextLabel.Text = status;
statusTextLabel.Refresh();
}
/// <summary>
/// Builds the path to the database and database log files and calls CopyDatabaseFile for each.
/// </summary>
private bool CopyLocalDB()
{
var dbFileName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, "DataPRO" /*tbDBName.Text.Trim()*/ + Settings.Default.Mdf);
var dbFileLogName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, "DataPRO" /*tbDBName.Text.Trim()*/ + Settings.Default.LogLdf);
//Copy .mdf file
if (CopyDatabaseFile(Settings.Default.Mdf, dbFileName))
{
//Copy .ldf file
CopyDatabaseFile(Settings.Default.LogLdf, dbFileLogName);
return true;
}
return false;
}
private bool CopyDatabaseFile(string extension, string destFileName)
{
//The database file that is to be copied was attached to (localdb)\DataPROInstance, so detach it so it can be copied
var resultString = ProcessSqlLocalDbCommand(Settings.Default.StopDataProInstance);
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning, MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
//var sourceFileName = string.Empty;
//sourceFileName = //cbCopyDataFromPrevious.Checked ?
// Path.Combine(_targetDir, Settings.Default.LocalDbFolder, "DataPRO" /*tbDBName.Text.Trim()*/ + extension); //:
//Path.Combine(_targetDir, Settings.Default.LocalDbFolder, Settings.Default.DataPRO + extension);
//if (File.Exists(destFileName))
//{
//Back it up
var _testIDTimestamp = string.Format("{0:0000}_{1:00}_{2:00} {3:00}_{4:00}", DateTime.Now.Year,
DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute);
var temp = destFileName.Replace(extension, "_" + _testIDTimestamp + extension);
File.Copy(destFileName, temp, true); //Don't worry about overwriting a db with this timestamp
//}
//try
//{
// File.Copy(sourceFileName, destFileName, true);
// //log.WriteEntry(sourceFileName + " was copied as " + destFileName);
//}
//catch (Exception ex)
//{
// MessageBox.Show("Previous database was not copied: " + ex.Message);
// return false;
//}
return true;
}
private int GetDatabaseVersion(bool usingLocalDatabase)
{
var oldVersion = 0;
try
{
DbOperations.Connection.DBName = "DataPRO"; //fix this tbDBName.Text;
if (true) //fix this usingLocalDatabase)
{
//log.WriteEntry("Using local database");
if (localSQLLocalDbDataExists)
{
//log.WriteEntry("Local SQLLocalDb database exists in previous install");
var resultString = InstallDatabase();
if (resultString.Length != 0)
{
MessageBox.Show(resultString, Settings.Default.Warning,
MessageBoxButtons.OK);
//Environment.Exit((int)STARTUP_ERRORS.ISO_DB_NOT_ATTACHED);
}
}
//else if (localSQLiteDataExists)
//{
// log.WriteEntry("Local SQLite database exists in previous install");
// DbOperations._usingMSSQL = false;
// oldVersion = UsePreviousDatabaseStructure(true);
// return oldVersion;
//}
else
{
//log.WriteEntry("No local database exists in previous install");
}
}
//else
//{
// log.WriteEntry("Using centralized database");
// DbOperations._usingMSSQL = true;
// DbOperations.Connection.Server = tbDBHostname.Text;
// DbOperations._usingNTLMAuthentication = cbUseNTLMAuthentication.Checked;
// DbOperations.Connection.Username = tbDBUser.Text;
// DbOperations.Connection.Password = tbDBPassword.Text;
// }
//First try the most recent database structure
using (var cmd = DbOperations.GetSQLCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = DbOperationsEnum.StoredProcedure.sp_DbVersionGet.ToString();
cmd.Parameters.Add(new SqlParameter("@Version", SqlDbType.Int) { Value = null });
var reader = cmd.ExecuteReader();
var dbVersionsList = new List<int>();
while (reader.Read())
{
var version = Convert.ToInt32(reader[DbOperations.DbVersions.DbVersionFields.Version.ToString()]);
dbVersionsList.Add(version);
}
reader.Close();
oldVersion = dbVersionsList.Max();
//log.WriteEntry("Result of using stored procedure sp_DbVersionGet is " + oldVersion);
if (oldVersion > 0)
{
return oldVersion;
}
}
finally
{
cmd.Connection.Dispose();
}
}
}
catch (Exception)
{
//log.WriteEntry("Exception while getting previous database version: " + ex.Message);
}
return 0; //fix thisUsePreviousDatabaseStructure(usingLocalDatabase);
}
/// <summary>
/// Get the path to the latest version of SQL Server Express LocalDB
/// installed, and run the command passed in.
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
private static string ProcessSqlLocalDbCommand(string command)
{
//SQL Server Express LocalDB 2014 is a Prerequisite of the DataPRO Installer,
//so it should be there unless it has been subsequently uninstalled.
var localDbPath = GetSqlServerLocalDBPath();
if (localDbPath == string.Empty)
{
//SQL Server LocalDb is not installed so display error and go away
return Settings.Default.SqlServerLocalDbNotInstalled;
}
var sqlLocalDbExeFileName = localDbPath + Settings.Default.SqlLocalDBExe;
return SqlCommandProcessor(sqlLocalDbExeFileName, command);
}
private static string AttachDatabase(string targetDir, string dbName, string sqlDbFileName, string sqlLogFileName)
{
const string SqlCmdExe = "sqlcmd.exe";
var oDBCToolsPath = DTS.Common.Utils.Database.GetODBCToolsPath(null);
var fullSqlcmdPath = Path.Combine(oDBCToolsPath, SqlCmdExe); //e.g. $"\"C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\110\\Tools\\Binn\\sqlcmd.exe\""
//var batchFileName = Path.Combine(targetDir, Settings.Default.ScriptsFolder, Settings.Default.AttachDBsbat);
var batchFileName = Settings.Default.AttachDBsbat;
return BatchCommandProcessor(batchFileName, dbName, sqlDbFileName, sqlLogFileName, fullSqlcmdPath);
}
private static string GetSqlServerLocalDBPath()
{
var highestVersionInstalledPath = string.Empty;
var rk = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
var sk1 = rk.OpenSubKey(Settings.Default.RegistrySoftwareMicrosoftMicrosoftSQLServerLocalDBInstalledVersions);
if (sk1 == null) return string.Empty;
var maxProductVersion = 0.0;
foreach (var productSubKeyName in sk1.GetSubKeyNames())
{
var thisVersion = -1D;
if (!double.TryParse(productSubKeyName, out thisVersion)) continue;
if (thisVersion < maxProductVersion) continue;
maxProductVersion = thisVersion;
var newKey = sk1.OpenSubKey(productSubKeyName);
if (newKey == null) continue;
var val = newKey.GetValue(Settings.Default.InstanceAPIPath, -1, RegistryValueOptions.None).ToString();
if ((val == "-1") || (!val.EndsWith(Settings.Default.SqlUserInstanceDll))) continue;
highestVersionInstalledPath = val.Substring(0, val.Length - Settings.Default.SqlUserInstanceDll.Length);
}
return highestVersionInstalledPath.Replace(Settings.Default.LocalDB, Settings.Default.Tools);
}
private static readonly StringBuilder sb = new StringBuilder();
static void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
if (outLine.Data != null)
{
if (string.IsNullOrWhiteSpace(outLine.Data))
{
sb.Append("\r\n");
}
sb.Append(outLine.Data);
}
}
public static string SqlCommandProcessor(string sqlLocalDbExeFileName, string command)
{
var resultString = string.Empty;
sb.Clear();
var process = new Process
{
StartInfo =
{
FileName = sqlLocalDbExeFileName,
Arguments = command,
LoadUserProfile = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};
//* Set ONLY ONE handler here.
process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
//* Start process
process.Start();
//* Read one element asynchronously
process.BeginErrorReadLine();
//* Read the other one synchronously
var output = process.StandardOutput.ReadToEnd();
Console.WriteLine(output);
//APILogger.Log("Result of " + command + " command is: " + output);
process.WaitForExit();
if (sb.Length > 0)
{
resultString = sb.ToString();
}
return resultString;
}
public static string BatchCommandProcessor(string batchFileName, string dbName, string sqlDbFileName, string sqlLogFileName,
string fullSqlcmdPath)
{
var resultString = string.Empty;
sb.Clear();
var process = new Process
{
StartInfo =
{
FileName = batchFileName,
Arguments = dbName + " " + "\"" + sqlDbFileName + "\"" + " " + "\"" + sqlLogFileName + "\"" + " " + "\"" + fullSqlcmdPath + "\"",
LoadUserProfile = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};
//* Set ONLY ONE handler here.
process.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
//* Start process
process.Start();
//* Read one element asynchronously
process.BeginErrorReadLine();
//* Read the other one synchronously
var output = process.StandardOutput.ReadToEnd();
Console.WriteLine(output);
//APILogger.Log("Result of attach " + dbName + " using " + sqlDbFileName + " and " + sqlLogFileName + " is:");
//APILogger.Log(output);
process.WaitForExit();
if (sb.Length > 0)
{
resultString = sb.ToString();
}
return resultString;
}
private bool LocalDataExists()
{
//if (!PreviousVersionInstalled())
//{
// return false;
//}
//Check for "DataPRO.mdf" (SqlLocalDb in 1.5 or later) in previously-installed folder
var sourceFileName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, "DataPRO" /*tbDBName.Text*/ + Settings.Default.Mdf);
if (File.Exists(sourceFileName))
{
localSQLLocalDbDataExists = true;
return true;
}
else
{
localSQLLocalDbDataExists = false;
//Check for "datapro.db" (SQLite file in 1.4 or earlier) in previously-installed folder
sourceFileName = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, "DataPRO" /*tbDBName.Text*/ + Settings.Default.Db);
if (File.Exists(sourceFileName))
{
localSQLiteDataExists = true;
return true;
}
else
{
localSQLiteDataExists = false;
return false;
}
}
}
private void MigrationForm_Load(object sender, EventArgs e)
{
numericUpDownDesiredVersion.Minimum = 61;
numericUpDownDesiredVersion.Maximum = DbOperations.CURRENT_DB_VERSION;
numericUpDownDesiredVersion.Value = DbOperations.CURRENT_DB_VERSION;
localDataExists = LocalDataExists();
if (localSQLLocalDbDataExists)
{
TbDatabasePath.Text = Path.Combine(_targetDir, Settings.Default.LocalDbFolder, "DataPRO" /*tbDBName.Text*/ + Settings.Default.Mdf);
}
}
private void numericUpDownDesiredVersion_ValueChanged(object sender, EventArgs e)
{
_desiredDatabaseVersion = Convert.ToInt32(numericUpDownDesiredVersion.Value);
}
}
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DatabaseMigrator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DatabaseMigrator")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("14d2b644-ac7a-4d21-a826-198ee1bc25f7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,139 @@
namespace DatabaseMigrator
{
partial class MigrationForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MigrationForm));
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.MigrationStatusLabel = new System.Windows.Forms.Label();
this.statusTextLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.TbDatabasePath = new System.Windows.Forms.TextBox();
this.numericUpDownDesiredVersion = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDesiredVersion)).BeginInit();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.Location = new System.Drawing.Point(191, 341);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(95, 33);
this.buttonOK.TabIndex = 0;
this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(327, 341);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(95, 33);
this.buttonCancel.TabIndex = 1;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// MigrationStatusLabel
//
this.MigrationStatusLabel.AutoSize = true;
this.MigrationStatusLabel.Location = new System.Drawing.Point(24, 389);
this.MigrationStatusLabel.Name = "MigrationStatusLabel";
this.MigrationStatusLabel.Size = new System.Drawing.Size(0, 13);
this.MigrationStatusLabel.TabIndex = 2;
//
// statusTextLabel
//
this.statusTextLabel.AutoSize = true;
this.statusTextLabel.Location = new System.Drawing.Point(24, 415);
this.statusTextLabel.Name = "statusTextLabel";
this.statusTextLabel.Size = new System.Drawing.Size(0, 13);
this.statusTextLabel.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(47, 53);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(244, 13);
this.label1.TabIndex = 4;
this.label1.Text = "The following database will be migrated to version ";
//
// TbDatabasePath
//
this.TbDatabasePath.Location = new System.Drawing.Point(50, 84);
this.TbDatabasePath.Name = "TbDatabasePath";
this.TbDatabasePath.Size = new System.Drawing.Size(530, 20);
this.TbDatabasePath.TabIndex = 5;
//
// numericUpDownDesiredVersion
//
this.numericUpDownDesiredVersion.Location = new System.Drawing.Point(297, 53);
this.numericUpDownDesiredVersion.Name = "numericUpDownDesiredVersion";
this.numericUpDownDesiredVersion.Size = new System.Drawing.Size(61, 20);
this.numericUpDownDesiredVersion.TabIndex = 6;
this.numericUpDownDesiredVersion.ValueChanged += new System.EventHandler(this.numericUpDownDesiredVersion_ValueChanged);
//
// MigrationForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(620, 468);
this.Controls.Add(this.numericUpDownDesiredVersion);
this.Controls.Add(this.TbDatabasePath);
this.Controls.Add(this.label1);
this.Controls.Add(this.statusTextLabel);
this.Controls.Add(this.MigrationStatusLabel);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MigrationForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "DataPRO Database Migration Utility";
this.TopMost = true;
this.Load += new System.EventHandler(this.MigrationForm_Load);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDesiredVersion)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Label MigrationStatusLabel;
private System.Windows.Forms.Label statusTextLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox TbDatabasePath;
private System.Windows.Forms.NumericUpDown numericUpDownDesiredVersion;
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Windows.Forms;
namespace DatabaseMigrator
{
static class MigrateDatabase
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
var targetDir = string.Empty;
//for (var i = 0; i < args.Length; i++)
//{
// switch (i)
// {
// case 0:
// targetDir = args[i];
// break;
// case 1:
// productVersion = new Version(args[i]);
// break;
// }
//}
targetDir = Environment.CurrentDirectory; // "C:\\DTS\\DTS.Suite\\1.9.569\\DataPRO";
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MigrationForm(targetDir));
}
}
}