Support Northwind schemas; fix the table count introduced in #362 - #363
Open
Wenjie Fan (gggdttt) wants to merge 2 commits into
Open
Support Northwind schemas; fix the table count introduced in #362#363Wenjie Fan (gggdttt) wants to merge 2 commits into
Wenjie Fan (gggdttt) wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #362, after the review question about whether Northwind's schema is supported. It isn't — this adds it. One of the three changes is a regression from #362, the other two are long-standing gaps; noting which is which below.
Regression from #362
The closing line
Generated N table definition(s)was added in #362 and countsCREATE TABLEstatements the regex matched, not files actually written. Those two numbers differ whenever a table is skipped, so the script can claim success for tables it never produced. It now reportsGenerated X of Y, and warns when aCREATE TABLEin the file could not be parsed.This is the change that matters most for anyone scripting a large database in chunks, where a quietly skipped table would only surface much later during migration.
Pre-existing gaps
Neither of these ever worked, before or after #362.
Double-quoted identifiers. Northwind mixes two styles in one file: 8 tables are scripted as
CREATE TABLE "Employees" ("EmployeeID" "int" NOT NULL, ...), the other 5 use brackets. On the pre-#362 script the quoted tables produceUnkown column type NULLfor every column and then fail onOut-FilewithMSFT"Employees".Table.al, which is not a legal Windows filename, so the run yields no table files at all. The identifier pattern, the bracket-stripping helper, the key-column regex and the comma splitter now all accept"..."alongside[...].ALTER TABLE ... ADD CONSTRAINT ... PRIMARY KEY. SSMS Script Table as > CREATE To puts the primary key inside theCREATE TABLE; Tasks > Generate Scripts emits it as a separateALTER TABLEafterwards. Only the inline form was recognised, so tables scripted the second way were dropped for having no key. Those statements are now collected up front and used when a table has no inline key.Testing
Northwind (from
microsoft/sql-server-samples): 13 of 13 tables, no warnings, generated AL compiles.Dynamics GP regression, 5 tables including a composite key: output is field-for-field identical to the pre-#362 script — same field IDs, names, AL types and key columns — and both versions compile.
The suite covers 14 scenarios and compiles every generated extension with
alc.exerather than only inspecting the text.