@@ -500,8 +500,8 @@ column = "email"
500500 # For backwards compatibility, we will write back to the removed `email` column whenever `profiles` is changed
501501 [actions.down]
502502 table = "profiles"
503− value = "email"
504− where = "id = user_id"
503+ value = "profiles.email"
504+ where = "users.id = profiles.user_id"
505505```
506506
507507### Indices
@@ -635,8 +635,8 @@ column = "email"
635635 # When `profiles` is changed in the new schema, we write the email address back to the removed column
636636 [actions.down]
637637 table = "profiles"
638− value = "email"
639− where = "id = user_id"
638+ value = "profiles.email"
639+ where = "users.id = profiles.user_id"
640640
641641[[actions]]
642642type = "add_column"
@@ -650,8 +650,8 @@ table = "profiles"
650650 # When `users` is updated in the old schema, we write the email value to `profiles`
651651 [actions.up]
652652 table = "users"
653− value = "email"
654− where = "user_id = id"
653+ value = "users.email"
654+ where = "profiles.user_id = users.id"
655655```
656656
657657_Example: turn a 1:N relationship between `users` and `accounts` into N:M and change the format of the associated `role`_
@@ -680,7 +680,7 @@ primary_key = ["account_id", "user_id"]
680680 [actions.up]
681681 table = "users"
682682 values = { user_id = "id", account_id = "account_id", role = "UPPER(account_role)" }
683− where = "user_id = id"
683+ where = "user_account_connections.user_id = users.id"
684684
685685[[actions]]
686686type = "remove_column"
@@ -690,8 +690,8 @@ column = "account_id"
690690 # When `user_account_connections` is updated, we write the `account_id` back to `users`
691691 [actions.down]
692692 table = "user_account_connections"
693− value = "account_id"
694− where = "id = user_id"
693+ value = "user_account_connections.account_id"
694+ where = "users.id = user_account_connections.user_id"
695695
696696[[actions]]
697697type = "remove_column"
@@ -701,8 +701,8 @@ column = "account_role"
701701 # When `user_account_connections` is updated, we write the lowercase role back to `users`
702702 [actions.down]
703703 table = "user_account_connections"
704− value = "LOWER(role)"
705− where = "id = user_id"
704+ value = "LOWER(user_account_connections.role)"
705+ where = "users.id = user_account_connections.user_id"
706706```
707707
708708## Commands and options