From 5cf7d76ebdceef474786faa1d1172cd37786726a Mon Sep 17 00:00:00 2001 From: Michal Buzik Date: Thu, 4 Sep 2025 07:38:49 +0200 Subject: [PATCH] New Test and updated schema mapping --- .../Resources/schema-mapping.json | 263 +++++++++++++++++- .../Parserer/SqlDumpFileParserTest.cs | 9 + 2 files changed, 271 insertions(+), 1 deletion(-) diff --git a/tbfDBBackup.Tests/Resources/schema-mapping.json b/tbfDBBackup.Tests/Resources/schema-mapping.json index 9943173..6359660 100644 --- a/tbfDBBackup.Tests/Resources/schema-mapping.json +++ b/tbfDBBackup.Tests/Resources/schema-mapping.json @@ -809,7 +809,268 @@ } ], "IsNewTable": false + }, + { + "TableName": "user", + "ColumnMappings": [ + { + "OldColumn": "Id", + "NewColumn": "Id", + "Status": "matched", + "ColumnDef": { + "Name": "Id", + "Type": "int(11)", + "Nullable": "NO" + } + }, + { + "OldColumn": "Name", + "NewColumn": "Name", + "Status": "matched", + "ColumnDef": { + "Name": "Name", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "Number", + "NewColumn": "Number", + "Status": "matched", + "ColumnDef": { + "Name": "Number", + "Type": "int(11)", + "Nullable": "YES" + } + }, + { + "OldColumn": "Password", + "NewColumn": "Password", + "Status": "matched", + "ColumnDef": { + "Name": "Password", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "Description", + "NewColumn": "Description", + "Status": "matched", + "ColumnDef": { + "Name": "Description", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "LastPwChange", + "NewColumn": "LastPwChange", + "Status": "matched", + "ColumnDef": { + "Name": "LastPwChange", + "Type": "datetime", + "Nullable": "YES" + } + } + ], + "IsNewTable": false + }, + { + "TableName": "group", + "ColumnMappings": [ + { + "OldColumn": "Id", + "NewColumn": "Id", + "Status": "matched", + "ColumnDef": { + "Name": "Id", + "Type": "int(11)", + "Nullable": "NO" + } + }, + { + "OldColumn": "Gid", + "NewColumn": "Gid", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "Gid", + "Type": "int(11)", + "Nullable": "YES" + } + }, + { + "OldColumn": "Name", + "NewColumn": "Name", + "Status": "matched", + "ColumnDef": { + "Name": "Name", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "User_id", + "NewColumn": "User_id", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "User_id", + "Type": "int(11)", + "Nullable": "YES" + } + } + ], + "IsNewTable": false + }, + { + "TableName": "component", + "ColumnMappings": [ + { + "OldColumn": "Id", + "NewColumn": "Id", + "Status": "matched", + "ColumnDef": { + "Name": "Id", + "Type": "int(11)", + "Nullable": "NO" + } + }, + { + "OldColumn": "Name", + "NewColumn": "Name", + "Status": "matched", + "ColumnDef": { + "Name": "Name", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "ClassName", + "NewColumn": "ClassName", + "Status": "matched", + "ColumnDef": { + "Name": "ClassName", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "ParentName", + "NewColumn": "ParentName", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "ParentName", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "ItemNr", + "NewColumn": "ItemNr", + "Status": "matched", + "ColumnDef": { + "Name": "ItemNr", + "Type": "int(11)", + "Nullable": "YES" + } + }, + { + "OldColumn": "Mode", + "NewColumn": "Mode", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "Mode", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "Logging", + "NewColumn": "Logging", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "Logging", + "Type": "varchar(255)", + "Nullable": "YES" + } + }, + { + "OldColumn": "Parameters", + "NewColumn": "Parameters", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "Parameters", + "Type": "varchar(8000)", + "Nullable": "YES" + } + } + ], + "IsNewTable": false + }, + { + "TableName": "measurementcorrection", + "ColumnMappings": [ + { + "OldColumn": "Id", + "NewColumn": "Id", + "Status": "matched", + "ColumnDef": { + "Name": "Id", + "Type": "int(11)", + "Nullable": "NO" + } + }, + { + "OldColumn": "RangeIx", + "NewColumn": "RangeIx", + "Status": "matched", + "ColumnDef": { + "Name": "RangeIx", + "Type": "int(11)", + "Nullable": "NO" + } + }, + { + "OldColumn": "Measurement", + "NewColumn": "Measurement", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "Measurement", + "Type": "float", + "Nullable": "YES" + } + }, + { + "OldColumn": "Correction", + "NewColumn": "Correction", + "Status": "matched", + "Note": "Could be part of JSON or renamed", + "ColumnDef": { + "Name": "Correction", + "Type": "float", + "Nullable": "YES" + } + }, + { + "OldColumn": "Component_id", + "NewColumn": "Component_id", + "Status": "matched", + "ColumnDef": { + "Name": "Component_id", + "Type": "int(11)", + "Nullable": "YES" + } + } + ], + "IsNewTable": false } - ] } \ No newline at end of file diff --git a/tbfDBBackup.Tests/compare_dumps/Parserer/SqlDumpFileParserTest.cs b/tbfDBBackup.Tests/compare_dumps/Parserer/SqlDumpFileParserTest.cs index cdc93a5..605279a 100644 --- a/tbfDBBackup.Tests/compare_dumps/Parserer/SqlDumpFileParserTest.cs +++ b/tbfDBBackup.Tests/compare_dumps/Parserer/SqlDumpFileParserTest.cs @@ -55,6 +55,15 @@ public class SqlDumpFileParserTest ValidateSqlDumpParserResults(sql); } + + [TestMethod] + public void SqlDumpParserFile_2() + { + string basePath = GetProjectRoot(); + string sql = Path.Combine(basePath,"Resources/slm50-250709-1549.sql"); + + ValidateSqlDumpParserResults(sql); + } private static void ValidateSqlDumpParserResults(string sql) {