Skip to content

Conversation

@allancascante
Copy link
Contributor

@allancascante allancascante commented Jan 7, 2026

Description

System Versioned tables must have a key before it could be created. With these changes system versioned (tables) will include the key as part of the create script being created.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (dotnet test)
  • Code follows contributing guidelines
  • Logging/telemetry updated if relevant
  • No protocol or behavioral regressions

Reviewers: Please read our reviewer guidelines

…ting the key right on the create so the with on versioned on will work. System versioned tables must have a key defined before the system versioning could be enabled.
// tables need the primary key to exist before SYSTEM_VERSIONING can be enabled.
// The Scripter.Script(urns) pipeline scripts indexes/constraints as separate ALTER
// statements which fails for temporal tables. (see GitHub issue azuredatastudio#20315)
if (urns.Count == 1 && this.Parameters.Operation == ScriptingOperationType.Create)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there cases where temporal tables might come with multiple URNs? here we are checking for count-1, what happens if we are scripting more than one temporal tables?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For vs code extension, there is no way to script as create more than one table at the same time, at least from the existing UI, currently we could only select one table from a database a script as create that one table.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the history table? When scripting a temporal table from the UI, does the selection automatically include the associated history table from the temporal folder structure, or does it only script the main table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only script the main table


ScriptingService service = new ScriptingService();
await service.HandleScriptExecuteRequest(scriptingParams, requestContext.Object);
Thread.Sleep(2000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? seems it is added for debugging purpose.

@ssreerama ssreerama self-requested a review January 7, 2026 20:36
@allancascante allancascante self-assigned this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants