@@ -127,6 +127,51 @@ describe("Example Sql Parsing", () => {
127127 expect ( 1 ) . toBeTruthy ( ) ;
128128 } ) ;
129129
130+ it ( "Run Parser mssql simple" , async ( ) => {
131+ // load sql
132+ var sql = `CREATE TABLE Persons
133+ (
134+ PersonID int NOT NULL,
135+ LastName varchar(255),
136+ FirstName varchar(255),
137+ Address varchar(255),
138+ City varchar(255),
139+ Primary Key(PersonId)
140+ );
141+
142+ CREATE TABLE Orders
143+ (
144+ OrderID int NOT NULL PRIMARY KEY,
145+ PersonID int NOT NULL,
146+ FOREIGN KEY ([PersonID]) REFERENCES [Persons]([PersonID])
147+ );` ;
148+ // console.log(sql);
149+
150+ // run parser
151+ const parser = new SqlSimpleParser ( "postgres" ) ;
152+
153+ // get models
154+ const result = parser . feed ( sql ) . ToModel ( ) ;
155+
156+ // write to json file
157+ const dataKey = expect . getState ( ) . currentTestName || "unknown" ;
158+
159+ const expectedResult = await getExpected ( dataSource , dataKey ) ;
160+
161+ if ( result != expectedResult ) {
162+ await updateExpected ( dataSource , dataKey , result ) ;
163+ }
164+
165+ // console.log(result);
166+ expect ( result ) . toStrictEqual ( expectedResult ) ;
167+
168+ // write to json file
169+ // await fs.writeFileSync(
170+ // "output-pg_simple.json",
171+ // JSON.stringify(models, null, "\t")
172+ // );
173+ expect ( 1 ) . toBeTruthy ( ) ;
174+ } ) ;
130175 it ( "Run Parser postgres simple" , async ( ) => {
131176 // load sql
132177 var sql = `CREATE TABLE "humanresources_department" (
0 commit comments