Skip to content
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
merged 2 commits into from Apr 22, 2016
Merged

Mssql fixes #1362

merged 2 commits into from Apr 22, 2016

Conversation

@wolfgang42
Copy link
Contributor

@wolfgang42 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 Runner.run (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 2 commits Apr 21, 2016
Previously it would never actually create the table, as
object_id() returns null if the table doesn't exist
PR #1289 made it quote the index/constraint names, but did not update the tests accordingly.
@elhigu
Copy link
Member

@elhigu elhigu commented Apr 22, 2016

thanks!

@elhigu elhigu merged commit d990708 into knex:master Apr 22, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@wubzz wubzz mentioned this pull request Apr 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants