2amigos / yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension
https://github.com/2amigos/yii2-usuario
Other
294 stars 141 forks source link

FK has no action for ON UPDATE #272

Open bscheshirwork opened 5 years ago

bscheshirwork commented 5 years ago

What steps will reproduce the problem?

I can't change id of user becouse FK is no action for ON UPDATE

What a reason for this behavior?

for profile, social_account, token

What is the expected result?

ALTER TABLE profile DROP FOREIGN KEY fk_profile_user;
ALTER TABLE profile
ADD CONSTRAINT fk_profile_user
FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE;

What do you get instead?

FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;

https://github.com/2amigos/yii2-usuario/blob/c0afdd55c948f0aac1c8ef06e2136003485e9585/src/User/Migration/m000000_000002_create_profile_table.php#L39-L41

docs https://github.com/yiisoft/yii2/blob/558cd482d8a0525fceec8646ea20ccc9b7c3fdf4/framework/db/Migration.php#L453-L464

tonydspaniard commented 5 years ago

Some people do want RESTRICT vs CASCADE as modifying the ID of the user is not very common. How can we implement both worlds?

bscheshirwork commented 5 years ago

Some people do want RESTRICT vs CASCADE as modifying the ID

In module's internal logic? We must put both of model in synchronized state