Verified Commit 02006270 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

See #542: fixed issue with empty actor during upgrade script

parent e1628a33
......@@ -71,7 +71,15 @@ def update_uploads(libraries_by_user, stdout):
def update_orphan_uploads(open_api, stdout):
privacy_level = "everyone" if open_api else "instance"
first_superuser = User.objects.filter(is_superuser=True).order_by("pk").first()
first_superuser = (
if not first_superuser:
stdout.write("* No superuser found, skipping update orphan uploads")
library, _ = models.Library.objects.get_or_create(
......@@ -285,7 +285,7 @@ def create_actor(user):
args["private_key"] = private.decode("utf-8")
args["public_key"] = public.decode("utf-8")
return federation_models.Actor.objects.create(**args)
return federation_models.Actor.objects.create(user=user, **args)
......@@ -189,10 +189,14 @@ then run the migrations script.
On docker-setups::
# if you missed this one from a previous upgrade
docker-compose run --rm api python script create_actors --no-input
docker-compose run --rm api python script migrate_to_user_libraries --no-input
On non docker-setups::
# if you missed this one from a previous upgrade
python api/ script create_actors --no-input
python api/ script migrate_to_user_libraries --no-input
If the scripts ends without errors, you're instance should be updated and ready to use :)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment