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

Resolve type before using it in migrations #700

Conversation

matthewmcgarvey
Copy link
Member

Fixes #689

Imagine accidentally doing add admin : Boolean where Boolean should have actually been Bool but you forgot.

Before this change the error you got from that would look like:
CleanShot 2021-07-09 at 16 03 57@2x

With this change, it now looks like:
CleanShot 2021-07-09 at 16 03 31@2x

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.

Yup! This is sweet. I could never figure out how to best detect Arrays. I love that type < Array. That's perfect.

{% nilable = true %}
{% end %}
{% if type.is_a?(Generic) %}
{% if type < Array %}
Copy link
Member

Choose a reason for hiding this comment

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

Oh! Sweet.. That's how you do it 🥳

@matthewmcgarvey matthewmcgarvey merged commit e4d8d20 into luckyframework:master Jul 9, 2021
@matthewmcgarvey matthewmcgarvey deleted the resolve-migration-column-type branch July 9, 2021 20:31
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.

Confusing error when using incorrect type in migration
2 participants