Skip to content
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

[bugfix] Ensure pending_approval set on statuses + status faves #3415

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

tsmethurst
Copy link
Contributor

Description

Fix an issue with the interaction policy migration where pending_approval did not have NOT NULL set on it, and write a migration to correct statuses and status_faves. Also ensure that this field is always set by adding some logic for it to the type converter.

Note, this PR doesn't bother completely undoing and redoing the previous migration by dropping and recreating the statuses + status faves tables, because I'm not really keen on having folks who've run the RC having to do another massive migration. The NOT NULL is not actually that important as long as we remember to set it ourselves anyway.

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have not leveraged AI to create the proposed changes.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@tsmethurst tsmethurst changed the title [bugfix] Ensure pending_approval set on statuses + status faves [bugfix] Ensure pending_approval set on statuses + status faves Oct 11, 2024
@tsmethurst tsmethurst merged commit cb9008f into main Oct 11, 2024
3 checks passed
@tsmethurst tsmethurst deleted the pending_approval_fix branch October 11, 2024 13:21
@mirabilos
Copy link
Contributor

Is it deliberate that you didn’t add an ALTER TABLE to set the column to NOT NULL afterwards?

That would add a safety net and possibly help the query optimiser.

@tsmethurst
Copy link
Contributor Author

Yes it's deliberate, it's mentioned in the PR description.

@mirabilos
Copy link
Contributor

I don’t quite see that. The second paragraph says the NOT NULL is “not important” (but see what I noted above) but not why you don’t fire a simple ALTER TABLE statuses ALTER COLUMN pending_approval SET NOT NULL; to fix it up, which is quick enough.

@tsmethurst
Copy link
Contributor Author

You can do that on postgres but not on sqlite. The process for doing the same on sqlite is convoluted and involves either dropping and recreating the column, or creating an entirely new table, deleting the old table, and then renaming the new one. Rather than introduce even more disparity between the two versions and potentially add another long migration I opted to just let it be.

@tsmethurst
Copy link
Contributor Author

At some point in the future we'll probably make a version that migrates all tables to some nice neatly defined version anyway, and then we can remove all the old migrations, so if the columns of some people's DBs are missing a NOT NULL constraint until then it's not really that important.

@mirabilos
Copy link
Contributor

mirabilos commented Oct 13, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants