Ah, your Post schema already contains a tags field which is defined as a oneToMany relation to Tag. The attribute names must be unique.
I see two ways you can change this.
1. UI Way
- In the content type builder, remove the existing tags relation field in the post scheme
- save
- Now you’re free to create the many-to-many relation as you intended
2. Manual way
- In your post’s schema.json, change the tags attribute to:
"tags": {
"type": "relation",
"relation": "manyToMany",
"target": "api::tag.tag",
"mappedBy": "tags"
}
- In your tag’s schema.json, add a posts attribute:
"posts": {
"type": "relation",
"relation": "manyToMany",
"target": "api::post.post",
"inversedBy": "posts"
}
EDIT:
Actually you can just use the content type builder to change the existing oneToMany relation in the Post to a manyToMany relation, lol. After saving, if you check the other side of that relation (Tag), you will find that it has been added by Strapi automatically.