@contextmanager<EOL>def alter_field(old_field, new_field, filters: List[str]):
model = define_fake_model({'<STR_LIT:title>': old_field})<EOL>project = migrations.state.ProjectState.from_apps(apps)<EOL>with connection.schema_editor() as schema_editor:<EOL><INDENT>execute_migration(schema_editor, [<EOL>migrations.CreateModel(<EOL>model.__name__,<EOL>fields=[<EOL>('<STR_LIT:title>', old_field.clone())<EOL>]<EOL>)<EOL>], project)<EOL><DEDENT>with filtered_schema_editor(*filters) as (schema_editor, calls):<EOL><INDENT>execute_migration(schema_editor, [<EOL>migrations.AlterField(<EOL>model.__name__,<EOL>'<STR_LIT:title>',<EOL>new_field<EOL>)<EOL>], project)<EOL><DEDENT>yield calls<EOL>
Alters a field from one state to the other.

    Arguments:
        old_field:
            The field before altering it.

        new_field:
            The field after altering it.

        filters:
            List of strings to filter
            SQL statements on.