-
Notifications
You must be signed in to change notification settings - Fork 160
Change on how system versioned tables are scripted as create #2561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
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
dotnet test)Reviewers: Please read our reviewer guidelines