Skip to content

Commit d963170

Browse files
authored
Merge pull request #22 from JoshLuedeman/feature/sql-project-generation
Feature/sql-project-generation
2 parents 2167a45 + 17f9679 commit d963170

16 files changed

Lines changed: 2369 additions & 174 deletions

.github/workflows/build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ jobs:
2828
- name: Build
2929
run: dotnet build CosmosToSqlAssessment.csproj --configuration Release --no-restore
3030

31-
- name: Run tests
32-
run: dotnet test CosmosToSqlAssessment.csproj --configuration Release --no-build --verbosity normal
33-
continue-on-error: true # Continue even if no tests are found
34-
3531
- name: Publish build artifacts
3632
uses: actions/upload-artifact@v4
3733
with:

Models/CosmosModels.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class AssessmentResult
1818
// Properties for multi-database handling
1919
public bool GenerateSeparateExcel { get; set; } = false;
2020
public List<AssessmentResult> IndividualDatabaseResults { get; set; } = new();
21+
22+
// Output path information (not serialized to JSON)
23+
public string AnalysisFolderPath { get; set; } = string.Empty;
2124
}
2225

2326
/// <summary>
@@ -93,10 +96,14 @@ public class ChildTableSchema
9396
{
9497
public string TableName { get; set; } = string.Empty;
9598
public string SourceFieldPath { get; set; } = string.Empty;
96-
public string ChildTableType { get; set; } = string.Empty; // "Array" or "NestedObject"
99+
public string ChildTableType { get; set; } = string.Empty; // "Array" or "NestedObject" or "ManyToMany"
97100
public Dictionary<string, FieldInfo> Fields { get; set; } = new();
98101
public long SampleCount { get; set; }
99102
public string ParentKeyField { get; set; } = "ParentId"; // Foreign key to parent table
103+
104+
// Many-to-many analysis properties
105+
public List<IndexRecommendation> RecommendedIndexes { get; set; } = new();
106+
public List<string> TransformationNotes { get; set; } = new();
100107
}
101108

102109
/// <summary>
@@ -186,4 +193,17 @@ public class PerformanceTrend
186193
public string Trend { get; set; } = string.Empty; // "Increasing", "Decreasing", "Stable"
187194
public double ChangePercentage { get; set; }
188195
}
196+
197+
/// <summary>
198+
/// Analysis result for array storage strategy decisions
199+
/// </summary>
200+
public class ArrayAnalysis
201+
{
202+
public string ArrayName { get; set; } = string.Empty;
203+
public int ItemCount { get; set; }
204+
public bool ShouldCreateTable { get; set; }
205+
public string RecommendedStorage { get; set; } = string.Empty; // "JSON", "DelimitedString", "RelationalTable"
206+
public string RecommendedSqlType { get; set; } = string.Empty;
207+
public string TransformationLogic { get; set; } = string.Empty;
208+
}
189209
}

Models/SqlModels.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class SqlMigrationAssessment
88
public string RecommendedPlatform { get; set; } = string.Empty;
99
public string RecommendedTier { get; set; } = string.Empty;
1010
public List<DatabaseMapping> DatabaseMappings { get; set; } = new();
11+
public List<SharedSchema> SharedSchemas { get; set; } = new(); // New: Tracks deduplicated schemas
1112
public List<IndexRecommendation> IndexRecommendations { get; set; } = new();
1213
public List<ForeignKeyConstraint> ForeignKeyConstraints { get; set; } = new();
1314
public List<UniqueConstraint> UniqueConstraints { get; set; } = new();
@@ -65,6 +66,23 @@ public class ChildTableMapping
6566
public string ParentKeyColumn { get; set; } = "ParentId";
6667
public List<FieldMapping> FieldMappings { get; set; } = new();
6768
public List<string> RequiredTransformations { get; set; } = new();
69+
public string? SharedSchemaId { get; set; } = null; // Reference to shared schema if deduplicated
70+
}
71+
72+
/// <summary>
73+
/// Represents a shared schema that multiple child tables can reference
74+
/// </summary>
75+
public class SharedSchema
76+
{
77+
public string SchemaId { get; set; } = string.Empty; // Unique identifier based on schema hash
78+
public string SchemaName { get; set; } = string.Empty; // Friendly name (e.g., "Address", "ContactInfo")
79+
public string TargetSchema { get; set; } = "dbo";
80+
public string TargetTable { get; set; } = string.Empty; // The shared table name
81+
public List<FieldMapping> FieldMappings { get; set; } = new();
82+
public List<string> SourceContainers { get; set; } = new(); // Containers that use this schema
83+
public List<string> SourceFieldPaths { get; set; } = new(); // Field paths that use this schema
84+
public int UsageCount { get; set; } // Number of times this schema is used
85+
public string SchemaHash { get; set; } = string.Empty; // Hash of field structure for comparison
6886
}
6987

7088
/// <summary>

Models/SqlProjectModels.cs

Whitespace-only changes.

0 commit comments

Comments
 (0)