Change on how system versioned tables are scripted as create#2561
Change on how system versioned tables are scripted as create#2561allancascante wants to merge 1 commit intomainfrom
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.
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.
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.
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.
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.
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