diff --git a/redbot/core/drivers/json.py b/redbot/core/drivers/json.py index 10d30146b..4dd60a71c 100644 --- a/redbot/core/drivers/json.py +++ b/redbot/core/drivers/json.py @@ -187,11 +187,11 @@ class JsonDriver(BaseDriver): continue if not isinstance(data, dict): continue - for cog, inner in data.items(): + cog_name = _dir.stem + for cog_id, inner in data.items(): if not isinstance(inner, dict): continue - for cog_id in inner: - yield cog, cog_id + yield cog_name, cog_id async def import_data(self, cog_data, custom_group_data): def update_write_data(identifier_data: IdentifierData, _data): diff --git a/redbot/setup.py b/redbot/setup.py index d445f4a6c..5b54114cb 100644 --- a/redbot/setup.py +++ b/redbot/setup.py @@ -108,12 +108,9 @@ def get_storage_type(): storage = None while storage is None: print() - print("Please choose your storage backend (if you're unsure, choose 1).") + print("Please choose your storage backend (if you're unsure, just choose 1).") print("1. JSON (file storage, requires no database).") - print( - "2. PostgreSQL (Requires a database server)" - "\n(Warning: You cannot convert postgres instances to other backends yet)" - ) + print("2. PostgreSQL (Requires a database server)") storage = input("> ") try: storage = int(storage) @@ -382,7 +379,7 @@ def delete( @cli.command() @click.argument("instance", type=click.Choice(instance_list)) -@click.argument("backend", type=click.Choice(["json"])) # TODO: GH-3115 +@click.argument("backend", type=click.Choice(["json", "postgres"])) def convert(instance, backend): """Convert data backend of an instance.""" current_backend = get_current_backend(instance) @@ -394,8 +391,6 @@ def convert(instance, backend): if current_backend == BackendType.MONGOV1: raise RuntimeError("Please see the 3.2 release notes for upgrading a bot using mongo.") - elif current_backend == BackendType.POSTGRES: # TODO: GH-3115 - raise RuntimeError("Converting away from postgres isn't currently supported") else: new_storage_details = asyncio.run(do_migration(current_backend, target))