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

Fix comments not being applied to increments columns #2243

Merged
merged 5 commits into from
Sep 28, 2017
Merged

Fix comments not being applied to increments columns #2243

merged 5 commits into from
Sep 28, 2017

Conversation

richraid21
Copy link
Contributor

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
Copy link
Member

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.

Copy link
Member

@elhigu elhigu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

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

@elhigu
Copy link
Member

elhigu commented Sep 28, 2017

This looks great now, thanks!

@elhigu elhigu merged commit 7032dff into knex:master Sep 28, 2017
elhigu pushed a commit to ivanfilhoz/knex that referenced this pull request Oct 16, 2017
* 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants