ForestAdmin / lumber

Install Forest Admin in minutes.
https://www.forestadmin.com
MIT License
2.08k stars 106 forks source link

refactor: refactor through model name with hasMany relationships #449

Closed GuillaumeCisco closed 4 years ago

GuillaumeCisco commented 4 years ago

Pull Request checklist:

According to https://sequelize.org/master/manual/advanced-many-to-many.html

By passing a string to through above, we are asking Sequelize to automatically generate a model named User_Profiles as the through table (also known as junction table), with only two columns: userId and profileId. A composite unique key will be established on these two columns.
arnaudbesnier commented 4 years ago

Task linked: CU-52jbcp P3 - Mysql model definition - createdAt field present in schema when timestamp is defined as false

closingin commented 4 years ago

Duplicate of #445 😕

GuillaumeCisco commented 4 years ago

I've just reopened it for using the through key instead of modifying the junctionTable in the middle of a process. It allows to be less error prone as we are more declarative.

We could remove the junctionTable key from the reference object if it does not break compatibility.

closingin commented 4 years ago

@GuillaumeCisco Change your PR type to "refactor", this is not a fix anymore (also amend your commits if possible) 🙂

GuillaumeCisco commented 4 years ago

@GuillaumeCisco Change your PR type to "refactor", this is not a fix anymore (also amend your commits if possible) 🙂

Thank you! It is done 🚀

forest-bot commented 4 years ago

:tada: This PR is included in version 3.6.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: