C# Parser for SQL Migrations
Budget: $250 – $750 AUD
I need a lightweight, parser written in modern C# that scans legacy VB .NET source files, detects the embedded SQL migration tasks concerned only with table creation and table update statements, and converts each task into a strongly-typed C# class whose public properties represent:
• the full table schema
• every column’s data type and constraint information
• any index definitions found
• default values where they are declared
The goal is to end up with a list of schema changes to update a conceptual model because the migration code is the only true source of truth at this workplace.
Input
- A text file containing VB code with embedded SQL statements, e.g.:
adohelper.LogAndExecNonQuery(conv, "ALTER TABLE [Letter_Types] ADD [Pathology_Radiology] tinyint")
adohelper.LogAndExecNonQuery(conv, "ALTER TABLE [Letter_Types] ADD CONSTRAINT [DF_Letter_Types_Pathology_Radiology] DEFAULT 0 FOR Pathology_Radiology")
Output
- A collection of structured C# objects modelled like:
{ "Table": "Letter_Types", "Operation": "AddColumn", "Column": "Pathology_Radiology", "Type": "tinyint", "Default": "0" }
Required Features
• Extract SQL strings from VB code
• Identify SQL operations:
o ALTER TABLE … ADD COLUMN
o ALTER TABLE … ADD CONSTRAINT
o CREATE TABLE
o CREATE INDEX
o DROP COLUMN
o etc.
• Normalize identifiers (strip brackets, unify casing)
• Produce a structured representation
Not Required
• No need to understand VB logic
• No need to execute SQL
• No need to build the final schema
• No need to handle every edge case
Deliverable
- A small C# 8 or 10 library or script that:
• Reads a text file
• Extracts SQL statements
• Parses them into structured C# classes
• An MSTest project to load the sample code, parses it and assert the generated classes faithfully reflect the schema elements listed above.
Acceptance criteria
1. Running the test suite with `dotnet test` passes on the first run.
2. At least one creation script and one update script are parsed end-to-end.
3. Generated class names and property names are deterministic and readable.
4. No external dependencies beyond the standard .NET libraries and MSTest.
Afterwards the parser will be expanded to strip and stitch all SQL code embedded through out the legacy VB .NET application.
• the full table schema
• every column’s data type and constraint information
• any index definitions found
• default values where they are declared
The goal is to end up with a list of schema changes to update a conceptual model because the migration code is the only true source of truth at this workplace.
Input
- A text file containing VB code with embedded SQL statements, e.g.:
adohelper.LogAndExecNonQuery(conv, "ALTER TABLE [Letter_Types] ADD [Pathology_Radiology] tinyint")
adohelper.LogAndExecNonQuery(conv, "ALTER TABLE [Letter_Types] ADD CONSTRAINT [DF_Letter_Types_Pathology_Radiology] DEFAULT 0 FOR Pathology_Radiology")
Output
- A collection of structured C# objects modelled like:
{ "Table": "Letter_Types", "Operation": "AddColumn", "Column": "Pathology_Radiology", "Type": "tinyint", "Default": "0" }
Required Features
• Extract SQL strings from VB code
• Identify SQL operations:
o ALTER TABLE … ADD COLUMN
o ALTER TABLE … ADD CONSTRAINT
o CREATE TABLE
o CREATE INDEX
o DROP COLUMN
o etc.
• Normalize identifiers (strip brackets, unify casing)
• Produce a structured representation
Not Required
• No need to understand VB logic
• No need to execute SQL
• No need to build the final schema
• No need to handle every edge case
Deliverable
- A small C# 8 or 10 library or script that:
• Reads a text file
• Extracts SQL statements
• Parses them into structured C# classes
• An MSTest project to load the sample code, parses it and assert the generated classes faithfully reflect the schema elements listed above.
Acceptance criteria
1. Running the test suite with `dotnet test` passes on the first run.
2. At least one creation script and one update script are parsed end-to-end.
3. Generated class names and property names are deterministic and readable.
4. No external dependencies beyond the standard .NET libraries and MSTest.
Afterwards the parser will be expanded to strip and stitch all SQL code embedded through out the legacy VB .NET application.