diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt index de6d67284a..6248bb8ada 100644 --- a/docs/releases/5.0.txt +++ b/docs/releases/5.0.txt @@ -529,7 +529,36 @@ Should become:: uuid = Char32UUIDField(primary_key=True, default=uuid.uuid4) Running the :djadmin:`makemigrations` command will generate a migration -containing a no-op ``AlterField`` operation. +containing a no-op ``AlterField`` operation. By default, new +``UUIDField`` instances will use the ``UUID`` column type. If a +``CHAR(32)`` column is needed, for example if you want to ensure +consistency with existing columns, use a ``Char32UUIDField``. + +---- + +Alternatively, existing ``UUIDField`` columns could be altered in the +database to use a ``UUID`` column, by running a ``RunSQL`` operation in +a data migration:: + + class Migration(migrations.Migration): + ... + operations = [ + migrations.RunSQL( + sql=""" + ALTER TABLE my_app_model1 MODIFY my_uuid_field1 UUID NOT NULL; + ALTER TABLE my_app_model2 MODIFY my_uuid_field2 UUID NOT NULL; + """, + elidable=True, + ) + ] + +Once migrated, this would need no additional consideration when adding +new ``UUIDField`` instances. + +Please note that for larger tables or when ``UUIDFields`` are used as +primary keys or in constraints, this operation could either require a +lengthy table rebuild, or even end up failing to migrate the constraints +without additional steps (see :ticket:`33507` for details). Miscellaneous -------------