Skip to content

Handle more scriptable object types (synonyms, UDTs, table triggers)#61

Merged
alex-bochkov merged 3 commits intomainfrom
codex/improve-scriptselectedobject.cs-for-object-selection
Jan 13, 2026
Merged

Handle more scriptable object types (synonyms, UDTs, table triggers)#61
alex-bochkov merged 3 commits intomainfrom
codex/improve-scriptselectedobject.cs-for-object-selection

Conversation

@alex-bochkov
Copy link
Copy Markdown
Contributor

Motivation

  • Improve object resolution when scripting a selected identifier so more SMO object types can be scripted correctly.
  • Some database objects (synonyms, user-defined table types, user-defined types, and table-level triggers) were not handled by the previous lookup flow.
  • Ensure triggers are located by scanning table triggers when the object is a SQL_TRIGGER.
  • Make scripting work for more real-world selections beyond tables, procs and functions.

Description

  • Added resolution branches for db.Synonyms, db.UserDefinedTableTypes, and db.UserDefinedTypes to the object lookup logic in ScriptSelectedObject.cs.
  • Added trigger resolution via a new helper FindTableTrigger(Database db, string triggerName, string schemaName) that returns the matching SqlSmoObject from table triggers.
  • Updated the lookup to treat objects with TypeDesc == "SQL_TRIGGER" specially and call FindTableTrigger when appropriate.
  • Committed changes under the message: Handle more scriptable object types.

Testing

  • No automated tests were run for this change.

Codex Task

@alex-bochkov alex-bochkov linked an issue Jan 13, 2026 that may be closed by this pull request
@alex-bochkov alex-bochkov merged commit 2490bdf into main Jan 13, 2026
@alex-bochkov alex-bochkov deleted the codex/improve-scriptselectedobject.cs-for-object-selection branch January 13, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Script definition to new window doesn't support triggers

1 participant