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

Mssql fixes #1362

merged 2 commits into from Apr 22, 2016


None yet
2 participants

wolfgang42 commented Apr 21, 2016

This PR fixes the mssql driver's createTableIfNotExists() function, which previously (due to an inverted condition) would never actually create the table.

It also gets the integration tests mostly working; there's one last error I haven't resolved yet:

  1) Integration Tests mssql | mssql Schema createTable rejects setting foreign key where tableName is not typeof === string:
     TypeError: Cannot read property 'sql' of undefined
      at TableCompiler.alterTableForCreate (lib/schema/tablecompiler.js:9:10850)
      at TableCompiler.create (lib/schema/tablecompiler.js:9:2125)
      at TableCompiler.toSQL (lib/schema/tablecompiler.js:9:1456)
      at TableBuilder.toSQL (lib/schema/tablebuilder.js:9:1630)
      at SchemaCompiler.createTable (lib/schema/compiler.js:9:2304)
      at SchemaCompiler.toSQL (lib/schema/compiler.js:9:1782)
      at SchemaBuilder.toSQL (lib/schema/builder.js:9:2260)
      at lib/runner.js:9:1117
  From previous event:
      at (lib/runner.js:9:733)
      at SchemaBuilder.Target.then (lib/interface.js:9:1345)

Thanks to @elhigu for all the help understanding how the knex internals work.

wolfgang42 added some commits Apr 21, 2016

mssql dialect: make createTableIfNotExists actually work.
Previously it would never actually create the table, as
object_id() returns null if the table doesn't exist
mssql dialect: Fix integration tests that check for quoted wrappers.
PR #1289 made it quote the index/constraint names, but did not update the tests accordingly.

This comment has been minimized.


elhigu commented Apr 22, 2016


@elhigu elhigu merged commit d990708 into tgriesser:master Apr 22, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@wubzz wubzz referenced this pull request Apr 22, 2016


PR for #1297 #1299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment