Rename the `forwards` function in the migration file to `migrate`
The Piccolo migrations look something like this:
from piccolo.apps.migrations.auto.migration_manager import MigrationManager
ID = "2022-02-26T17:38:44:758593"
VERSION = "0.69.2" # The version of Piccolo used to create it
DESCRIPTION = "Optional description"
async def forwards():
manager = MigrationManager(
migration_id=ID,
app_name="my_app",
description=DESCRIPTION
)
def run():
# Replace this with something useful:
print(f"running {ID}")
manager.add_raw(run)
return manager
As pointed out in this comment, it's a bit confusing to have the function called forwards.
What it actually does is return a MigrationManager instance. Whether we're running the migration forwards or backwards, we call that function to get the MigrationManager instance.
A more accurate name for the function would be something like migrate. Any thoughts? Is there another better name? Or just leave as it is?
migrations migrate? May be just run?
Been using run as a universal convention in my own "before piccolo" system, for migrations and background tasks. migrations run is short and obvious.
piccolo migrations run
transit or shift? mutate xD