You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance support for CLR stored procedures and table-valued functions
- Updated SqlChangeTracker to include CLR stored procedures (type 'PC') and table-valued functions (type 'FT') in the introspection and scripting processes.
- Added functionality to script CLR stored procedures and table-valued functions, including their parameters and return types.
- Enhanced the normalization process for CLR table-valued functions to suppress differences related to NULL tokens and formatting.
- Implemented tests to verify the inclusion and correct scripting of CLR objects.
- Updated the SyncCommandService to handle differences in CLR functions and queues more effectively.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,13 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
10
10
### Fixed
11
11
- Script schema-level permissions after schema creation and before schema extended properties.
12
12
- Match legacy non-canonical schema-less object filenames to the scripted object name when the canonical name requires percent escaping.
13
+
- Treat equivalent queue option formatting, explicit default `ON [PRIMARY]`, and disabled default activation as compatible during comparison.
14
+
- Treat legacy explicit `NULL` tokens on CLR table-valued function return columns as compatible during comparison and preserve them during compatibility reconciliation when the rest of the definition matches.
13
15
- Trailing semicolon differences on `INSERT` statement lines in data scripts are now suppressed during comparison normalization; scripts emitted with and without statement terminators compare as compatible (#47).
14
16
- Legacy `TableData` scripts now compare as compatible when they differ from canonical output only by `SET IDENTITY_INSERT` semicolons or top-level `N'...'` string literal prefixes, including inside multi-line `INSERT ... VALUES (...)` statements.
15
17
- Whitespace-only separator lines now compare as compatible with empty blank lines during `status` and `diff`.
16
18
- Preserve reference banner-comment formatting and module-declaration identifier quoting during programmable-object compatibility reconciliation.
- Discover and script SQL CLR scalar functions as `Function` objects.
23
+
- Discover and script SQL CLR table-valued functions as `Function` objects.
24
+
- Discover and script SQL CLR stored procedures as `StoredProcedure` objects.
20
25
-`sqlct init` now prompts interactively for connection details (server, database, auth, credentials, trust-server-certificate) when run without flags in a new project directory (#36).
21
26
- Connection flags (`--server`, `--database`, `--auth`, `--user`, `--password`, `--trust-server-certificate`) for non-interactive/scripted `init` use (#36).
22
27
-`--skip-connection-test` flag for `sqlct init` to bypass the connection test step (#36).
Copy file name to clipboardExpand all lines: README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,8 +52,12 @@ Current runtime scope for `status`, `diff`, and `pull` covers:
52
52
-`FullTextStoplist`
53
53
-`SearchPropertyList`
54
54
55
+
Stored procedure scripting covers T-SQL procedures and SQL CLR stored procedures (`sys.objects.type = 'P'` and `PC`).
56
+
55
57
Table scripting also includes standalone user-created table statistics (`CREATE STATISTICS`) as post-create table statements. Current statistics option coverage includes effective sampling (`FULLSCAN` or `SAMPLE <n> PERCENT`), `PERSIST_SAMPLE_PERCENT = ON`, `NORECOMPUTE`, `INCREMENTAL=ON`, and `AUTO_DROP = ON|OFF` when the source server exposes the required metadata. `MAXDOP`, `STATS_STREAM`, `ROWCOUNT`, and `PAGECOUNT` remain deferred.
56
58
59
+
Function scripting covers T-SQL scalar/table functions and SQL CLR scalar/table-valued functions (`sys.objects.type = 'FS'` and `FT`), including `EXTERNAL NAME` assembly bindings.
60
+
57
61
When `data.trackedTables` is configured, `status`, `diff`, and `pull` also process `TableData` artifacts for those explicit tracked tables.
Copy file name to clipboardExpand all lines: specs/01-cli.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,9 +195,10 @@ Behavior:
195
195
- Deleted: object exists only in target.
196
196
- Changed: normalized script content differs.
197
197
- Suppress changes when scripts are identical after normalization.
198
-
- Normalization in v1 is limited to line-ending/trailing-newline stability for deterministic comparison.
198
+
- Normalization includes line-ending/trailing-newline stability plus explicitly listed compatibility rules for deterministic comparison.
199
199
- Whitespace-only lines are normalized to empty lines during comparison so blank separators with spaces or tabs compare as compatible.
200
200
- Trailing semicolons on `INSERT` statement lines are stripped during normalization; scripts emitted with and without statement terminators compare as compatible.
201
+
- Equivalent `Queue` option spacing, line wrapping, explicit default `ON [PRIMARY]`, and disabled default activation compare as compatible.
201
202
- When `data.trackedTables` is configured, `status` also reports data-script differences for tracked tables.
202
203
- Status output MUST report schema and data summaries separately.
203
204
- Exit codes:
@@ -217,9 +218,10 @@ Behavior:
217
218
- Without `--object`, output concatenated per-object diffs in stable order.
218
219
- Changed objects use DB-vs-folder unified diff.
219
220
- Added/deleted objects use empty-side vs script-side unified diff.
220
-
- Normalization in v1 is limited to line-ending/trailing-newline stability for deterministic comparison.
221
+
- Normalization includes line-ending/trailing-newline stability plus explicitly listed compatibility rules for deterministic comparison.
221
222
- Whitespace-only lines are normalized to empty lines during comparison so blank separators with spaces or tabs compare as compatible.
222
223
- Trailing semicolons on `INSERT` statement lines are stripped during normalization; scripts emitted with and without statement terminators compare as compatible.
224
+
- Equivalent `Queue` option spacing, line wrapping, explicit default `ON [PRIMARY]`, and disabled default activation compare as compatible.
223
225
- Diff output uses a chunked format: only changed lines and their surrounding context are shown, not the entire file.
224
226
-`--context <N>` controls the number of unchanged context lines shown before and after each changed segment (default: 3). Negative values are treated as 0.
225
227
- When two change segments are close enough that their context regions overlap, they are merged into a single hunk.
- optional `WITH EXECUTE AS <CALLER|OWNER|'principal'>`
382
+
-`AS EXTERNAL NAME [assembly].[class].[method]`
378
383
- Regex replacements from overrides MUST be applied before compatibility line-map reconciliation.
379
384
- Compatibility definition line-map reconciliation MUST be applied when reference file exists.
380
385
- When no compatible reference spacing is preserved, procedure emission MUST use the canonical programmable-object whitespace rules from Section 6.1.
@@ -388,8 +393,24 @@ Each emitted statement MUST be followed by `GO`.
388
393
2. parameter-level (by parameter name, then property name).
389
394
390
395
### 8.4 Functions
391
-
- Functions are scripted through programmable-object framing rules with object types `FN`, `TF`, `IF` and level type `FUNCTION`.
392
-
- Definition text MUST come from `OBJECT_DEFINITION`.
396
+
- Functions are scripted through programmable-object framing rules with object types `FN`, `TF`, `IF`, `FS`, `FT` and level type `FUNCTION`.
397
+
- T-SQL function definition text for `FN`, `TF`, and `IF` MUST come from `OBJECT_DEFINITION`.
398
+
- CLR function metadata for `FS` and `FT` MUST be sourced from `sys.assembly_modules`, `sys.assemblies`, and `sys.parameters`.
399
+
- CLR scalar function (`FS`) output MUST emit:
400
+
-`CREATE FUNCTION [schema].[name] (<parameters>)`
401
+
-`RETURNS <return_type>`
402
+
-`WITH EXECUTE AS <CALLER|OWNER|'principal'>`
403
+
-`EXTERNAL NAME [assembly].[class].[method]`
404
+
- CLR table-valued function (`FT`) return-column metadata MUST be sourced from `sys.columns`, `sys.types`, and type-schema metadata for the function object.
405
+
- CLR table-valued function (`FT`) order metadata MUST be sourced from `sys.function_order_columns` when available.
406
+
- CLR table-valued function (`FT`) output MUST emit:
407
+
-`CREATE FUNCTION [schema].[name] (<parameters>)`
408
+
-`RETURNS TABLE (`
409
+
- one return column per line in `column_id` order using `[name] <type>`
- Regex replacements from overrides MUST be applied before final emission.
394
415
- When no compatible reference spacing is preserved, function emission MUST use the canonical programmable-object whitespace rules from Section 6.1.
395
416
- Grants and extended properties MUST follow module body.
@@ -781,6 +802,8 @@ When compatibility reference files are available, `sqlct` MAY apply reconciliati
781
802
- Trailing semicolons on `INSERT` statement lines MUST be stripped by comparison normalization so that scripts emitted with and without statement terminators compare as compatible.
782
803
- For `TableData`, trailing semicolons on `SET IDENTITY_INSERT` lines MUST also be stripped by comparison normalization.
783
804
- For `TableData`, comparison normalization MUST treat legacy top-level `N'...'` string literals inside single-line or multi-line `INSERT ... VALUES (...)` statements as compatible with canonical `'...'` literals; canonical script generation remains governed by Section 8.26.
805
+
- For `Queue`, comparison normalization MUST treat equivalent single-line and multi-line queue option formatting as compatible, MAY treat explicit `ON [PRIMARY]` as equivalent to an omitted default primary filegroup, and MAY treat disabled activation containing only default owner execution context as equivalent to omitted activation.
806
+
- For CLR table-valued `Function` scripts, comparison normalization MAY treat legacy explicit `NULL` tokens on return-column lines as compatible with canonical return-column lines that omit nullability, including legacy cases where the final return-column line also carries the closing `)` token.
784
807
785
808
## 11. Error and Unsupported Behavior
786
809
- Missing SQL object metadata for requested object MUST fail with an error.
Copy file name to clipboardExpand all lines: src/SqlChangeTracker/PACKAGE_README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,8 +53,12 @@ Current runtime scope for `status`, `diff`, and `pull` covers:
53
53
-`FullTextStoplist`
54
54
-`SearchPropertyList`
55
55
56
+
Stored procedure scripting covers T-SQL procedures and SQL CLR stored procedures (`sys.objects.type = 'P'` and `PC`).
57
+
56
58
Table scripting also includes standalone user-created table statistics (`CREATE STATISTICS`) as post-create table statements. Current statistics option coverage includes effective sampling (`FULLSCAN` or `SAMPLE <n> PERCENT`), `PERSIST_SAMPLE_PERCENT = ON`, `NORECOMPUTE`, `INCREMENTAL=ON`, and `AUTO_DROP = ON|OFF` when the source server exposes the required metadata. `MAXDOP`, `STATS_STREAM`, `ROWCOUNT`, and `PAGECOUNT` remain deferred.
57
59
60
+
Function scripting covers T-SQL scalar/table functions and SQL CLR scalar/table-valued functions (`sys.objects.type = 'FS'` and `FT`), including `EXTERNAL NAME` assembly bindings.
61
+
58
62
When `data.trackedTables` is configured, `status`, `diff`, and `pull` also process `TableData` artifacts for those explicit tracked tables.
59
63
60
64
Feature-backed object types are included when the target database exposes them, such as `FullTextCatalog`, `FullTextStoplist`, and `SearchPropertyList`.
0 commit comments