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

Fix comments not being applied to increments columns #2243

Merged
merged 5 commits into from Sep 28, 2017

Conversation

Projects
None yet
2 participants
@richraid21
Contributor

richraid21 commented Sep 25, 2017

Addresses #2210

Changes

  • I first had to remove the explicit check in the getModifiers function that excluded auto-increment columns.

  • I then abstracted the default column name logic for increments columns to a separate function on the prototype of the generic column compiler. I did this because if a user specified a comment on an increments column with no explicit name, the dialect level comment method could not figure out the default column name. It is implemented with a lookup map for defaults. In the future, if new defaults are added, developers can add a new default key.

  • Finally, I added a specific assertion in a test case to ensure comments are applied to increments columns in the future

Notes

  • I added a .vscode/ exclusion to the .gitignore. Visual Studio Code allows developers to set up settings on a workspace basis.
@elhigu

This comment has been minimized.

Collaborator

elhigu commented Sep 27, 2017

/home/travis/build/tgriesser/knex/src/schema/columncompiler.js
30:1 error Line 30 exceeds the maximum line length of 100 max-len

100 sounds really small limit though, it could be increased to at least 140 or like that.

@elhigu

elhigu approved these changes Sep 27, 2017

Implementation looks nice and clean 👍

Only extra thing that I would like to see would be real integration test where column is created to db and result checked from there.

@richraid21

This comment has been minimized.

Contributor

richraid21 commented Sep 27, 2017

  • Shortened Line Length
  • Added explicit comment tests for mysql and postgres dialects
@elhigu

This comment has been minimized.

Collaborator

elhigu commented Sep 28, 2017

This looks great now, thanks!

@elhigu elhigu merged commit 7032dff into tgriesser:master Sep 28, 2017

1 check passed

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

elhigu added a commit to ivanslf/knex that referenced this pull request Oct 16, 2017

Fix comments not being applied to increments columns (tgriesser#2243)
* Removed check increments check on the modifiers. Implemented a default lookup map on the generic columncompiler

* Ignore VS Code User Workspace Settings

* Added test case to assert comments are added to increments columns

* Shortened line length and added explicit db tests for postgres and mysql dialects

* Added check for modifiers on incrementing types and only allow comment modifiers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment