Added test app

This commit is contained in:
2025-09-01 07:42:35 -05:00
parent fc25f64feb
commit b0cb847d23
16 changed files with 980 additions and 6 deletions

View File

@@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36408.4 d17.14
VisualStudioVersion = 17.14.36408.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbTools", "DbTools.csproj", "{B2FC6FFB-A182-4458-AA43-D0A0E6A0F118}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbToolsTester", "DbToolsTester\DbToolsTester.csproj", "{B5AA90EC-0026-47F7-85C0-E1EEE72A0607}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{B2FC6FFB-A182-4458-AA43-D0A0E6A0F118}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2FC6FFB-A182-4458-AA43-D0A0E6A0F118}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2FC6FFB-A182-4458-AA43-D0A0E6A0F118}.Release|Any CPU.Build.0 = Release|Any CPU
{B5AA90EC-0026-47F7-85C0-E1EEE72A0607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5AA90EC-0026-47F7-85C0-E1EEE72A0607}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5AA90EC-0026-47F7-85C0-E1EEE72A0607}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5AA90EC-0026-47F7-85C0-E1EEE72A0607}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

6
DbToolsTester/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View File

@@ -0,0 +1,110 @@
<?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>{B5AA90EC-0026-47F7-85C0-E1EEE72A0607}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>DbToolsTester</RootNamespace>
<AssemblyName>DbToolsTester</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.Desktop.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Data.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Drawing.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v23.2.Core, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Forms\MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Forms\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DbTools.csproj">
<Project>{b2fc6ffb-a182-4458-aa43-d0a0e6a0f118}</Project>
<Name>DbTools</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
</Project>

290
DbToolsTester/Forms/MainForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,290 @@
namespace DbToolsTester.Forms {
partial class MainForm {
/// <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() {
this.components = new System.ComponentModel.Container();
DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions1 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject1 = new DevExpress.Utils.SerializableAppearanceObject();
DevExpress.XtraEditors.Controls.EditorButtonImageOptions editorButtonImageOptions2 = new DevExpress.XtraEditors.Controls.EditorButtonImageOptions();
DevExpress.Utils.SerializableAppearanceObject serializableAppearanceObject2 = new DevExpress.Utils.SerializableAppearanceObject();
this.barManager1 = new DevExpress.XtraBars.BarManager(this.components);
this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
this.barDockControlRight = new DevExpress.XtraBars.BarDockControl();
this.bar1 = new DevExpress.XtraBars.Bar();
this.bar2 = new DevExpress.XtraBars.Bar();
this.bar3 = new DevExpress.XtraBars.Bar();
this.bbiDelta = new DevExpress.XtraBars.BarButtonItem();
this.bbiMigrations = new DevExpress.XtraBars.BarButtonItem();
this.bbiApplyBoth = new DevExpress.XtraBars.BarButtonItem();
this.XtraTabControl1 = new DevExpress.XtraTab.XtraTabControl();
this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage();
this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage();
this.xtraTabPage3 = new DevExpress.XtraTab.XtraTabPage();
this.xtraTabPage4 = new DevExpress.XtraTab.XtraTabPage();
this.db1Sql = new System.Windows.Forms.RichTextBox();
this.db2Sql = new System.Windows.Forms.RichTextBox();
this.deltaSql = new System.Windows.Forms.RichTextBox();
((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.XtraTabControl1)).BeginInit();
this.XtraTabControl1.SuspendLayout();
this.xtraTabPage1.SuspendLayout();
this.xtraTabPage2.SuspendLayout();
this.xtraTabPage3.SuspendLayout();
this.SuspendLayout();
//
// barManager1
//
this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] {
this.bar1,
this.bar2,
this.bar3});
this.barManager1.DockControls.Add(this.barDockControlTop);
this.barManager1.DockControls.Add(this.barDockControlBottom);
this.barManager1.DockControls.Add(this.barDockControlLeft);
this.barManager1.DockControls.Add(this.barDockControlRight);
this.barManager1.Form = this;
this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
this.bbiDelta,
this.bbiMigrations,
this.bbiApplyBoth});
this.barManager1.MainMenu = this.bar2;
this.barManager1.MaxItemId = 3;
this.barManager1.StatusBar = this.bar3;
//
// barDockControlTop
//
this.barDockControlTop.CausesValidation = false;
this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.barDockControlTop.Location = new System.Drawing.Point(0, 0);
this.barDockControlTop.Manager = this.barManager1;
this.barDockControlTop.Size = new System.Drawing.Size(840, 41);
//
// barDockControlBottom
//
this.barDockControlBottom.CausesValidation = false;
this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.barDockControlBottom.Location = new System.Drawing.Point(0, 458);
this.barDockControlBottom.Manager = this.barManager1;
this.barDockControlBottom.Size = new System.Drawing.Size(840, 20);
//
// barDockControlLeft
//
this.barDockControlLeft.CausesValidation = false;
this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.barDockControlLeft.Location = new System.Drawing.Point(0, 41);
this.barDockControlLeft.Manager = this.barManager1;
this.barDockControlLeft.Size = new System.Drawing.Size(0, 417);
//
// barDockControlRight
//
this.barDockControlRight.CausesValidation = false;
this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.barDockControlRight.Location = new System.Drawing.Point(840, 41);
this.barDockControlRight.Manager = this.barManager1;
this.barDockControlRight.Size = new System.Drawing.Size(0, 417);
//
// bar1
//
this.bar1.BarName = "Tools";
this.bar1.DockCol = 0;
this.bar1.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
this.bar1.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
new DevExpress.XtraBars.LinkPersistInfo(this.bbiDelta),
new DevExpress.XtraBars.LinkPersistInfo(this.bbiMigrations),
new DevExpress.XtraBars.LinkPersistInfo(this.bbiApplyBoth)});
this.bar1.Text = "Tools";
//
// bar2
//
this.bar2.BarName = "Main menu";
this.bar2.DockCol = 0;
this.bar2.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
this.bar2.OptionsBar.MultiLine = true;
this.bar2.OptionsBar.UseWholeRow = true;
this.bar2.Text = "Main menu";
//
// bar3
//
this.bar3.BarName = "Status bar";
this.bar3.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
this.bar3.DockCol = 0;
this.bar3.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
this.bar3.OptionsBar.AllowQuickCustomization = false;
this.bar3.OptionsBar.DrawDragBorder = false;
this.bar3.OptionsBar.UseWholeRow = true;
this.bar3.Text = "Status bar";
//
// bbiDelta
//
this.bbiDelta.Caption = "Generate Delta";
this.bbiDelta.Id = 0;
this.bbiDelta.Name = "bbiDelta";
this.bbiDelta.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ToolbarItemClicked);
//
// bbiMigrations
//
this.bbiMigrations.Caption = "Get Migration List";
this.bbiMigrations.Id = 1;
this.bbiMigrations.Name = "bbiMigrations";
this.bbiMigrations.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ToolbarItemClicked);
//
// bbiApplyBoth
//
this.bbiApplyBoth.Caption = "Apply Delta && Migrations";
this.bbiApplyBoth.Id = 2;
this.bbiApplyBoth.Name = "bbiApplyBoth";
this.bbiApplyBoth.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ToolbarItemClicked);
//
// XtraTabControl1
//
editorButtonImageOptions1.Image = ((System.Drawing.Image)(resources.GetObject("editorButtonImageOptions1.Image")));
editorButtonImageOptions2.Image = ((System.Drawing.Image)(resources.GetObject("editorButtonImageOptions2.Image")));
this.XtraTabControl1.CustomHeaderButtons.AddRange(new DevExpress.XtraTab.Buttons.CustomHeaderButton[] {
new DevExpress.XtraTab.Buttons.CustomHeaderButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "Open Databases", -1, true, true, editorButtonImageOptions1, serializableAppearanceObject1, "", "open", null),
new DevExpress.XtraTab.Buttons.CustomHeaderButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "Clear All", -1, true, true, editorButtonImageOptions2, serializableAppearanceObject2, "", "clear", null)});
this.XtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.XtraTabControl1.Location = new System.Drawing.Point(0, 41);
this.XtraTabControl1.Name = "XtraTabControl1";
this.XtraTabControl1.SelectedTabPage = this.xtraTabPage1;
this.XtraTabControl1.Size = new System.Drawing.Size(840, 417);
this.XtraTabControl1.TabIndex = 4;
this.XtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
this.xtraTabPage1,
this.xtraTabPage2,
this.xtraTabPage3,
this.xtraTabPage4});
this.XtraTabControl1.CustomHeaderButtonClick += new DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventHandler(this.XtraTabControl1_CustomHeaderButtonClick);
//
// xtraTabPage1
//
this.xtraTabPage1.Controls.Add(this.db1Sql);
this.xtraTabPage1.Name = "xtraTabPage1";
this.xtraTabPage1.Size = new System.Drawing.Size(838, 375);
this.xtraTabPage1.Text = "Live / Production DB";
//
// xtraTabPage2
//
this.xtraTabPage2.Controls.Add(this.db2Sql);
this.xtraTabPage2.Name = "xtraTabPage2";
this.xtraTabPage2.Size = new System.Drawing.Size(838, 392);
this.xtraTabPage2.Text = "Schema / Updated DB";
//
// xtraTabPage3
//
this.xtraTabPage3.Controls.Add(this.deltaSql);
this.xtraTabPage3.Name = "xtraTabPage3";
this.xtraTabPage3.Size = new System.Drawing.Size(838, 392);
this.xtraTabPage3.Text = "Delta SQL";
//
// xtraTabPage4
//
this.xtraTabPage4.Name = "xtraTabPage4";
this.xtraTabPage4.Size = new System.Drawing.Size(0, 0);
this.xtraTabPage4.Text = "Migrations";
//
// db1Sql
//
this.db1Sql.Dock = System.Windows.Forms.DockStyle.Fill;
this.db1Sql.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.db1Sql.Location = new System.Drawing.Point(0, 0);
this.db1Sql.Name = "db1Sql";
this.db1Sql.ReadOnly = true;
this.db1Sql.Size = new System.Drawing.Size(838, 375);
this.db1Sql.TabIndex = 0;
this.db1Sql.Text = "This database is the one that is currently in use by the application. This databa" +
"se needs to be updated to fit the most recent schema.";
//
// db2Sql
//
this.db2Sql.Dock = System.Windows.Forms.DockStyle.Fill;
this.db2Sql.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.db2Sql.Location = new System.Drawing.Point(0, 0);
this.db2Sql.Name = "db2Sql";
this.db2Sql.ReadOnly = true;
this.db2Sql.Size = new System.Drawing.Size(838, 392);
this.db2Sql.TabIndex = 1;
this.db2Sql.Text = resources.GetString("db2Sql.Text");
//
// deltaSql
//
this.deltaSql.Dock = System.Windows.Forms.DockStyle.Fill;
this.deltaSql.Font = new System.Drawing.Font("Lucida Console", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.deltaSql.Location = new System.Drawing.Point(0, 0);
this.deltaSql.Name = "deltaSql";
this.deltaSql.ReadOnly = true;
this.deltaSql.Size = new System.Drawing.Size(838, 392);
this.deltaSql.TabIndex = 1;
this.deltaSql.Text = "This SQL script contains all of the SQL commands required to make the production " +
"(existing) database the same as the new template database.";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(840, 478);
this.Controls.Add(this.XtraTabControl1);
this.Controls.Add(this.barDockControlLeft);
this.Controls.Add(this.barDockControlRight);
this.Controls.Add(this.barDockControlBottom);
this.Controls.Add(this.barDockControlTop);
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "DbTools Tester";
((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.XtraTabControl1)).EndInit();
this.XtraTabControl1.ResumeLayout(false);
this.xtraTabPage1.ResumeLayout(false);
this.xtraTabPage2.ResumeLayout(false);
this.xtraTabPage3.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevExpress.XtraBars.BarManager barManager1;
private DevExpress.XtraBars.Bar bar1;
private DevExpress.XtraBars.Bar bar2;
private DevExpress.XtraBars.Bar bar3;
private DevExpress.XtraBars.BarDockControl barDockControlTop;
private DevExpress.XtraBars.BarDockControl barDockControlBottom;
private DevExpress.XtraBars.BarDockControl barDockControlLeft;
private DevExpress.XtraBars.BarDockControl barDockControlRight;
private DevExpress.XtraBars.BarButtonItem bbiDelta;
private DevExpress.XtraBars.BarButtonItem bbiMigrations;
private DevExpress.XtraBars.BarButtonItem bbiApplyBoth;
private DevExpress.XtraTab.XtraTabControl XtraTabControl1;
private DevExpress.XtraTab.XtraTabPage xtraTabPage1;
private DevExpress.XtraTab.XtraTabPage xtraTabPage2;
private DevExpress.XtraTab.XtraTabPage xtraTabPage3;
private DevExpress.XtraTab.XtraTabPage xtraTabPage4;
private System.Windows.Forms.RichTextBox db1Sql;
private System.Windows.Forms.RichTextBox db2Sql;
private System.Windows.Forms.RichTextBox deltaSql;
}
}

View File

@@ -0,0 +1,61 @@
using DbTools;
using System.Data.SQLite;
using System.IO;
using System.Windows.Forms;
namespace DbToolsTester.Forms {
public partial class MainForm : DevExpress.XtraEditors.XtraForm {
public string DatabaseName { get; set; }
public string Database1File { get; set; }
public string Database2File { get; set; }
public MainForm() {
InitializeComponent();
}
private void XtraTabControl1_CustomHeaderButtonClick(object sender, DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventArgs e) {
string tag = e.Button.Tag?.ToString();
if (tag == "open") {
Database1File = getDatabaseFile("Select Original / Production Database...");
Database2File = getDatabaseFile("Select Template / New Schema Database...");
DatabaseName = Path.GetFileNameWithoutExtension(Database1File);
Text += " [ Production DB = " + Path.GetFileName(Database1File) + "; Schema DB = " + Path.GetFileName(Database2File) + " ]";
} else if (tag == "clear") {
Database1File = null;
Database2File = null;
db1Sql.Clear();
db2Sql.Clear();
deltaSql.Clear();
Text = "DbSync Tester";
}
}
private string getDatabaseFile(string title = "Select Database File...") {
OpenFileDialog dlg = new OpenFileDialog() {
Filter = "Database Files (*.sql;*.sqlite;*.db)|*.sql;*.sqlite;*.db|SQL Files (*.sql)|*.sql|Sqlite Files (*.sqlite;*.db)|*.sqlite;*.db|Text Files (*.txt)|*.txt|All Files (*.*)|*.*",
CheckFileExists = true,
Multiselect = false,
Title = title
};
if (dlg.ShowDialog() == DialogResult.OK) {
return dlg.FileName;
}
return null;
}
private void ToolbarItemClicked(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
if (e.Item.Equals(bbiDelta)) {
SQLiteConnection db1 = new SQLiteConnection("Data Source=" + Database1File + ";Version=3;");
SQLiteConnection db2 = new SQLiteConnection("Data Source=" + Database2File + ";Version=3;");
Delta delta = new Delta();
deltaSql.Text = delta.BuildDelta(db1, db2, true, true);
db1Sql.Text = delta.Db1Sql;
db2Sql.Text = delta.Db2Sql;
}
}
}
}

View File

@@ -0,0 +1,213 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="barManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="editorButtonImageOptions1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAAC3RFWHRUaXRsZQBPcGVuO0nJ
d5IAAAkwSURBVFhHxZd3WFRnFocFBVuMmkQ3MWssGMVI1Owq9lhAETQGUFRsURRjVIxGFNEQESwsyop0
kS4MCIgU0VURiIU2dBABlY4MZYY2w4CU357vzoySPIQn+8/me54Xhin3Pb/znXu5MwDAX0qfT/ZHP0vp
D+h/9SXpjz4WkygTgwgVQrUX7LmBBHtdwW+L6kvSH72WQqxiG/YPA7uoudF2UfPKzkdowiZEs+xn/7kx
Zg6zjOj1YcSQXrAi2edka/DgwQylP4n8U9xSNnfXGHcxdm5UaJop8ivDIGjmQ9pZjtdNfGSVhMIrdi/M
HL66s0B33PStxzXsTaxnY+Hav39Gn2WdkXVCfuCBhEofqMphj9l7FO1jvwdaumjVnfM1xH67OThirwW3
0AMoqYtCZUsQqltvorGdj9TnPPzkuLTtxn1bnHbfAJ3tanr0WdYJWRfYgR85a63M8V3Nz/PThYJcBb4y
kl21jem9g3oVwQ7A9nko8d6KTRMXrtkzxXKbxVf1D9IvoVjkirw6W5SI/PE4x5cKisXlIFPo7pxymN4/
nGCzocQK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N5xtNwa/88xJ9eTntt
gzqWkFLVhq+TyUIUbWTClai+TgRoc6mqfGWySibzWYxKElZ4LULFtQUo85yPsqvzCE2UesyHr8Gkds3x
I8eTk91jKvmskxUwJsBIDcE7ZiDbYwN3ugiYlLeGoJayhExKCauonVX+y0m4jNJRQkpV4UV4L0K5J2Mh
Sj0XoJxkpe7zSMrEmnjhPAf8M7PgtPqzBPKNJgb5fDNhAIMVMOrat2oZvG0zqIiZCNn+JYK3EdtngLdV
Q84X4G2REWQ8HUGbiU3q9FsdgRunyZmK60bEhs8RwFhPGE6Bv6EafPUnw113gmjLrLFLyMdu6ZT99CcN
YLAC2P/F94kxxN+Ij3/HJ/3AblL/iE/lsMfsuKMItkg+mZMrClAm2Dmp+A7wZ/hfF/sMdzdNcF9w3n7T
Yn/In/x/oPC9K0Dx4K8BA/4LT4SoBjGcg8UAAAAASUVORK5CYII=
</value>
</data>
<data name="editorButtonImageOptions2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAApdEVYdFRpdGxlAFJlbW92ZTtEZWxldGU7QmFycztSaWJib247U3RhbmRhcmQ7Y1ZIMAAAB9ZJ
REFUWEfFlntUVVUex681kyUopog0KFwQfFxBeSgKqKDIQwFRAR0HGctUfASpgIKAoILIQxQxC0ZAfNEi
bEE+wlAQxNeIIpSupIiLD9AgRXOk1cT5zu93Lucm3Ouq/pl+a33Ym332/n2/e5+997kyAH8qWhv/n6j+
aI8+xCvdcP2PBPfvPV4jx8sMSAP/SvTthuu/1wj3eZV4jXijG87BbT3GazMgDe5buXBhqDJ5R6cyOamz
IiDgPWp7vftZnxuLF8uY2sWBKgJV8DPiL8QbZX7zQxoTEzsbExI6S+fOXUdt/bqfqU30NiCJv35ugX/k
nb1p+O+9OhHlnhSc8fMLo2c8G9FE14OvZC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8BBi7FCqIGcf0Xx8ksXk0q7lwF+IF69YW+ZrfxQbtVOPArW0ePvOYurj1Gynr7sRbit+5m4Est19EIz
hyseZw5TtIcYmPCPkR5XM6FhgENKwi55t/IghpdNci4Ofkm8OP5Ngr88DNfVtyEhhjYDHFISPir8Shiu
/5a4FL97/MsMSMGdX+SPxm+OVxv484Dsf9mcyoMRMH/dAAAAAElFTkSuQmCC
</value>
</data>
<data name="db2Sql.Text" xml:space="preserve">
<value>This database is the template for the currently expected version. New tables, indexes and triggers are expected to be held within this database. Once applied, the current production database should appear exactly the same as this database, except for the actual data contents.</value>
</data>
</root>

16
DbToolsTester/Program.cs Normal file
View File

@@ -0,0 +1,16 @@
using System;
using System.Windows.Forms;
namespace DbToolsTester {
internal static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Forms.MainForm());
}
}
}

View File

@@ -0,0 +1,33 @@
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("DbToolsTester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DbToolsTester")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[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("b5aa90ec-0026-47f7-85c0-e1eee72a0607")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <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 DbToolsTester.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if ((resourceMan == null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DbToolsTester.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <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 DbToolsTester.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1 @@
DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" />
<package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" />
</packages>

View File

@@ -6,12 +6,15 @@ using System.Threading.Tasks;
namespace DbTools {
public class Delta {
public string Db1Sql { get; set; }
public string Db2Sql { get; set; }
public string BuildDelta(IDbConnection currentDb, IDbConnection newDb, bool removeUnusedTables = false, bool removeUnusedColumns = false, bool removeUnusedTriggers = true, bool removeUnusedIndexes = true) {
Database db1 = new Database(currentDb);
Database db2 = new Database(newDb);
Database db1 = new Database(currentDb, true);
Database db2 = new Database(newDb, true);
Db1Sql = db1.ToSql();
Db2Sql = db2.ToSql();
return BuildDelta(db1, db2, removeUnusedTables, removeUnusedColumns, removeUnusedTriggers, removeUnusedIndexes);
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@@ -205,13 +206,30 @@ namespace DbTools.Model {
cmd.CommandText = "select * from sqlite_master";
using (var reader = cmd.ExecuteReader()) {
while (reader.Read()) {
if (reader["tbl_name"]?.ToString() == "sqlite_sequence") { continue; }
if (reader["tbl_name"]?.ToString() == "sqlite_sequence" || string.IsNullOrEmpty(reader["sql"]?.ToString())) { continue; }
string recordType = reader["type"]?.ToString();
if (recordType == "table") {
string sql = reader["sql"]?.ToString();
string tableName = reader["tbl_name"]?.ToString();
Match m = Regex.Match(sql, "CREATE TABLE \\S+ \\((.*)\\)", RegexOptions.Singleline);
if (!m.Success) {
Trace.TraceWarning("Unable to match regex on table " + tableName);
continue;
}
string tableSql = "";
int startIndex = m.Groups[1].Index;
int length = m.Groups[1].Length;
string columns = Regex.Replace(m.Groups[1].Value, "\\s{2,}", " ");
columns = Regex.Replace(columns.Replace(", ", ",").Replace(",\n", ","), ",(?!\\d+\\))", ",\r\n\t");
tableSql += sql.Substring(0, startIndex) + "\r\n\t" +
columns.Trim() + "\r\n" +
sql.Substring(startIndex + length) + ";";
Table table = new Table() {
TableName = reader["tbl_name"]?.ToString(),
CreateTableSql = reader["sql"]?.ToString(),
CreateTableSql = tableSql,
};
Tables.Add(table);
} else if (recordType == "index") {