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

Improve alter migrations error msg #524

Merged
merged 5 commits into from
Nov 12, 2020
Merged

Improve alter migrations error msg #524

merged 5 commits into from
Nov 12, 2020

Conversation

shortly-portly
Copy link
Contributor

@shortly-portly shortly-portly commented Nov 11, 2020

Improve error reporting for migration where a user accidently includes the type alongside the var name for rename, rename_belongs_to, remove, remove_belongs_to.

For example:

  remove name : String

produces the following error:

Error:

"remove" expected a symbol like ':user', instead got: 'name : String'.

in: "/data/db/migrations/20170127143149_create_users.cr":19:14

Try replacing...

  ▸ 'name : String' with 'name'

Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

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

I love this change! Any time we can have better error messages is always a win. Just left a few comments on it, but I think it's on the right direction!

src/avram/migrator/alter_table_statement.cr Show resolved Hide resolved
src/avram/migrator/alter_table_statement.cr Outdated Show resolved Hide resolved
src/avram/migrator/alter_table_statement.cr Outdated Show resolved Hide resolved
Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

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

Sweet! I think just the one missing colon from the example, but it's looking great! Thanks for doing this.

src/avram/migrator/alter_table_statement.cr Outdated Show resolved Hide resolved
Co-authored-by: Jeremy Woertink <jeremywoertink@gmail.com>
Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

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

Awesome! Great work 👍

@jwoertink jwoertink merged commit 7c75649 into luckyframework:master Nov 12, 2020
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.

Undefined macro 'symbol_expected_message' if mistake in migration rollback function
2 participants