atk4 / schema

Few classes built on top of Agile Data that can take care of your SQL database schema
https://agiletoolkit.org/
MIT License
4 stars 5 forks source link

Model hasOne type #59

Open abbadon1334 opened 4 years ago

abbadon1334 commented 4 years ago

when type is not defined for referenceOne and their_field don't have a type, it will get integer as default even if in atk4/field default type is string and atk4/schema SQL default type is string.

https://github.com/atk4/schema/blob/0a8e62c1f067a570f029eee4d48ee7284334cc22/src/Migration.php#L269

I discovered it today, while i add download feature to atk4/filestore in this pr : https://github.com/atk4/filestore/pull/14

The demos/basic.php of that pr is a perfect example of the problem.

if type is removed from the definition here : https://github.com/atk4/filestore/blob/ccb9aadef79c27d4ef1bd6011d1bf2e04ae01c86/src/Model/File.php#L19

the table will be created with field token as integer.

Discuss the problem even here : https://github.com/atk4/filestore/pull/13

I know schema is dangerous to be changed, but this probably is just an alignment of functionality between atk4/data and atk4/schema.

mvorisek commented 3 years ago

feel free to submit a PR, referencing column should be supported to have any type, but implicit integer type should stay