You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a model with a specified column name for a relationship, a second column with a slightly different name is created if the related model name contains a number. For example:
Location:
name: string nullablecoordinate_id: id nullablewhat_3_words_id: id nullablegoogle_plus_code_id: id nullablerelationships:
belongsTo: Coordinate, What3Words, GooglePlusCodebelongsToMany: Place, BoundaryWhat3Words:
word_1: stringword_2: stringword_3: stringrelationships:
belongsTo: Location
Note the two different columns, what3_words_id derived from the relationship, and what_3_words_id as specified manually in the blueprint.
I have not been able to determine what the proper convention should be for model names that contain numbers, but have styled this model name to match how the company itself styles their location IDs (see What3Words).
I can of course work around this by spelling out the number (i.e. WhatThreeWords) but it seems to me like a number in the middle of a model name should be treated as a word boundary rather than a continuation of the prior word, while consecutive numbers should be considered a single word for the purposes of column naming. Open to alternative views.
draft.yaml: shown above
The text was updated successfully, but these errors were encountered:
I'd have to dive down into core to see what they assume the name to be. But I would imagine it's singular, snake model name - which is what3_words. I don't see a bug here as the manual column name is at the users discretion. Unless the model code generated didn't set this as the foreign key in the relationship.
Issue:
When creating a model with a specified column name for a relationship, a second column with a slightly different name is created if the related model name contains a number. For example:
results in the following migration being created:
Note the two different columns,
what3_words_id
derived from the relationship, andwhat_3_words_id
as specified manually in the blueprint.I have not been able to determine what the proper convention should be for model names that contain numbers, but have styled this model name to match how the company itself styles their location IDs (see What3Words).
I can of course work around this by spelling out the number (i.e.
WhatThreeWords
) but it seems to me like a number in the middle of a model name should be treated as a word boundary rather than a continuation of the prior word, while consecutive numbers should be considered a single word for the purposes of column naming. Open to alternative views.draft.yaml: shown above
The text was updated successfully, but these errors were encountered: