Skip to content

Commit

Permalink
I cleaned up the Generate Scripts Button a little.
Browse files Browse the repository at this point in the history
  • Loading branch information
DataJuggler committed Feb 4, 2022
1 parent 32bbf42 commit 0f7f22a
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 415 deletions.
2 changes: 1 addition & 1 deletion DBCompare/DBCompare.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Version>6.2.0</Version>
<Version>6.2.1</Version>
<FileVersion>6.1.1</FileVersion>
<PackageId>DataJuggler.DBCompare</PackageId>
<Authors>DataJuggler</Authors>
Expand Down
87 changes: 47 additions & 40 deletions DBCompare/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions DBCompare/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,15 @@ private void CreateXmlFileButton_Click(object sender, EventArgs e)
/// </summary>
private void GenerateScriptsButton_Click(object sender, EventArgs e)
{
// Remove focus
HiddenButton.Focus();
Refresh();
Application.DoEvents();

// locals
string message = "-- This script is meant to be a time saver. Use only if the generated sql looks safe for your environment";
message += Environment.NewLine + "-- This tool is a work in progress. For now it does tables and fields. Stored Procedures";
message += Environment.NewLine + "-- are easy to update, and constraints and indexes are harder to script, so I put them off.";
message += Environment.NewLine + "-- By using this script, you acknowledge I am not responsible for any damage to your database.";
message += Environment.NewLine + "-- Thank you for using DB Compare." + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine;
StringBuilder sb = new StringBuilder(message);
Expand All @@ -216,7 +223,9 @@ private void GenerateScriptsButton_Click(object sender, EventArgs e)
string tablesSQL = GetUpdateTablesSQL();

// Get the fieldsSQL
string fieldsSQL = GetUpdateFieldsSQL();
string fieldsSQL = GetUpdateFieldsSQL();

// string storedProceduresSQL = on my to do list, but I am busy at work this week.

// Append each
sb.Append(tablesSQL);
Expand Down Expand Up @@ -937,10 +946,11 @@ private void CompareDatabaseStructure(Database sourceDatabase, Database targetDa
if (schemaComparison != null)
{
// Store the Comparison. Needed for the Generate Scripts
this.Comparison = schemaComparison;
Comparison = schemaComparison;

// Store the sourceDatabase
this.Comparison.SourceDatabase = sourceDatabase;
Comparison.SourceDatabase = sourceDatabase;
Comparison.TargetDatabase = targetDatabase;

// if the two database are equal
if (schemaComparison.IsEqual)
Expand Down Expand Up @@ -1056,7 +1066,7 @@ public string GetUpdateTablesSQL()

// Create a new instance of a 'StringBuilder' object.
StringBuilder sb = new StringBuilder("Use [");
sb.Append(Comparison.SourceDatabase.Name);
sb.Append(Comparison.TargetDatabase.Name);
sb.Append("]");
sb.Append(Environment.NewLine);
sb.Append("Go");
Expand Down
Loading

0 comments on commit 0f7f22a

Please sign in to comment.