that depends on the other? For instance, I have a groups table which has a pinned_message that references the id field on the messages talble, and the messages table which has a field group_id which references the group that the message belongs to.
Maybe you could create the tables first and then the foreign keys later. Or you could create a separate table for pinned messages, giving it both a group id and message id. And if you want there to be only one pinned message per group, you could give this table a compound primary key made up of both the group id and message id.
Resolve dependencies in the third table. Message shouldn't store group_id.
Обсуждают сегодня