Allow for media cover deletion #387
Nessun revisore
Etichette
Nessuna etichetta
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
Nessuna pietra miliare
Nessun progetto
Nessun assegnatario
2 partecipanti
Notifiche
Scadenza
Nessuna scadenza impostata.
Dipendenze
Nessuna dipendenza impostata.
Riferimento: Plume/Plume#387
Caricamento…
Add table
Crea riferimento in una nuova segnalazione
Descrizione non fornita.
Elimina ramo "delete-cover"
L'eliminazione di un ramo è definitiva. Nonostante il ramo eliminato potrebbe continuare ad esistere per un breve periodo di tempo prima di essere realmente eliminato, l'eliminazione NON PUÒ essere annullata in molti casi. Continuare?
Fix #356
sssiiiighqlite 🙀
unfortunately, you cannot drop or add constraints on sqlite tables without doing the create temporary table dance
Travis made me notice it. I knew for columns, I through it worked at least for constraints (it's only drop, add work just fine if I remember well)
Maybe this change should be integrated in the migrations that introduced constraints, because when you run migrations on an instance with illustrated articles, you get this error:
(After seeing this error on baptiste.gelez.xyz I tried to manually fix it, but it just ended in an instance reset 😬)
(I don't think it is a good idea to change previous migrations, but we don't really have choice…)
@BaptisteGelez I don't understand, what error did you run into? Is it when an article from before
2018-12-08-175515_constraints
reference a no longer existing media?It seem to happen when a media is used both as avatar and post cover. This query deletes it: https://github.com/Plume-org/Plume/blob/master/migrations/postgres/2018-12-08-175515_constraints/up.sql#L51 but it fails because it is used on a post.
Edit: actually, the media doesn't need to be used as avatar. If it owned by a duplicate user, the query will fail.
Edit 2: the user doesn't even need to be duplicated. For instance, some user have an empty
followers_endpoint
property, because they were created at a time this property didn't exist.Codecov Report
Travis is happy, I think we can safely merge that. Thanks!
I'm facing the same issue described by @BaptisteGelez while applying this migration, and I cannot afford to reset my instance. Is there anything to do to manually fix the issue? I can run SQL by hand if needed :)
@EliotBerriot try to find user with empty
followers_endpoint
withSELECT id, username FROM users WHERE followers_endpoint = '';
and if anything is returned, edit the follower endpoint so that it has a value (it can be anything as long as it is not null, nor already used by another user). If I remember correctly, that's how I fixed it on fediverse.blog. Sorry for the bug… 😕If it still doesn't work, try to check
users.ap_url
,user.inbox_url
anduser.outbox_url
too.@BaptisteGelez
SELECT id, username FROM users WHERE followers_endpoint = ''; returned a bunch of users, and I updated it w ith
UPDATE users SET followers_endpoint='noop' WHERE followers_endpoint = '';`This is the current returns for all the attributes you mentions:
Unfortunately, applying the migrations return the same error again:
The issues seems to lie within the medias/posts relation, so I'm not sure what it has to do with users?
Anyway, don't be sorry for this: I know the software was still in development and I could face this kind of bug, that was part of the deal :)
Okay, so maybe try to reset the post covers (it will not impact your articles as you didn't used them for Funkwhale's blog), with
UPDATE posts SET cover_id = null;
. I don't know if it will fix the issue, but it is worth a try.@BaptisteGelez at least with the
cover_id
thing I get another error:The issues is withing the
comments_in_response_to_id_fkey
constraint nowI made this script that should delete comments with invalid ActivityPub URLs, and their replies.
I didn't tested it, but it should only delete broken comments (and hopefully fix the migrations).
@BaptisteGelez unfortunately, this doesn't fix it (for me):