-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk adding tags can create "duplicate" posts_tags
rows
#21414
Comments
Thank you for the report. The problem code is located here. PRs are welcome 🙂 Aside from the double counting the duplicate post_id+tag_id rows in the If you're aware of any other problems this causes please elaborate. As for the fix there are two approaches:
|
post_tags
rows
post_tags
rowsposts_tags
rows
Hello there Please let me know if there's something I should watch out for. |
@kevinansfield I found 2 links while trying to do the DB migration:
Regardless, here's where I am: First question: Is that correct? If not, then how does the migration setup work now? (any docs?) Secondly, I saw some previous commits relating to column migrations for example: f9b0280 Thank you in advance! |
Not the same bug, but related: #19871 - this is an example of weirdness that results from duplicate entries. |
Your second link is about moving content between platforms. It isn't relevant here. And yeah, your first link is ancient. I didn't find any docs when I wrote my first migration last month, either. I've only done one migration, so am not expert here, but I /think/ I just ran the test and and observed the value required when it failed. Then updated the test file. :) Other notes: Yes, pick the next version number (minor, not patch), and use that. (If it takes the team a bit to merge this, then it'll need to be updated, but that's the idea.) The string in the file name is supposed to be year-month-day-hh-mm-ss-something-descriptive. |
…sts page TryGhost#21414 The commit includes a migration which adds a unique index to posts_tags table and handles the related error when bulk adding posts. The errors are ignored because the tags user wants to add are added/exist. This respects the editor's expectation as posts have the tags as the end result.
@kevinansfield @ErisDS @cathysarisky I have created a PR for this bug. I did 2 things:
Please merge it soon, if you find it worthy. |
Issue Summary
Tag count doubled when adding an existing tag in a post again via Context Menu.
The correct behaviour would be, if a tag is already existed in a post, it should not be tagged again using "Add a Tag" in Context Menu.
Steps to Reproduce
Ghost Version
5.94
Node.js Version
22
How did you install Ghost?
Linux / Local
Database type
MySQL 8
Browser & OS version
No response
Relevant log / error output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: