one day this will end
This commit is contained in:
parent
3df80b30f4
commit
d356ba88b7
|
@ -164,14 +164,16 @@ def check_succefull_migration(apps, schema_editor):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"Incoherent playlist database state : all local playlists do not have lib or too many libs"
|
f"Incoherent playlist database state : all local playlists do not have lib or too many libs"
|
||||||
)
|
)
|
||||||
elif actor.libraries.count() - 3 != not_build_in_libs or (
|
elif (
|
||||||
hasattr(actor, "channel") and actor.libraries.count() > 1
|
not hasattr(actor, "channel")
|
||||||
|
and actor.libraries.count() - 3 != not_build_in_libs
|
||||||
|
or (hasattr(actor, "channel") and actor.libraries.count() > 1)
|
||||||
):
|
):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"Incoherent library database state, check for errors in log and share them to the funkwhale team. Migration was abordted to prevent data loss.\
|
f"Incoherent library database state, check for errors in log and share them to the funkwhale team. Migration was abordted to prevent data loss.\
|
||||||
actor libs = {actor.libraries.count()} and acto not built-in lib = {not_build_in_libs} \
|
actor libs = {actor.libraries.count()} and acto not built-in lib = {not_build_in_libs} \
|
||||||
and acto pl ={actor.playlists.count()} and not channel lib = {actor.libraries.filter(channel__isnull=False).count()} \
|
and acto pl ={actor.playlists.count()} and not channel lib = {actor.libraries.filter(channel__isnull=False).count()} \
|
||||||
and actor.nae = {actor.name}"
|
and actor.name = {actor.name}"
|
||||||
)
|
)
|
||||||
for playlist in Playlist.objects.all():
|
for playlist in Playlist.objects.all():
|
||||||
if not federation_utils.is_local(playlist.fid):
|
if not federation_utils.is_local(playlist.fid):
|
||||||
|
|
|
@ -20,9 +20,7 @@ def create_playlist_libraries(apps, schema_editor):
|
||||||
playlist_with_lib_count = 0
|
playlist_with_lib_count = 0
|
||||||
|
|
||||||
for playlist in Playlist.objects.all():
|
for playlist in Playlist.objects.all():
|
||||||
if not federation_utils.is_local(playlist.fid) or not federation_utils.is_local(
|
if not federation_utils.is_local(playlist.actor.fid):
|
||||||
playlist.actor.fid
|
|
||||||
):
|
|
||||||
continue
|
continue
|
||||||
library = playlist.library
|
library = playlist.library
|
||||||
if not library:
|
if not library:
|
||||||
|
|
Loading…
Reference in New Issue