Skip to content

Instantly share code, notes, and snippets.

View nanomag's full-sized avatar

Mariano Aguirre Giraldo nanomag

  • Medellin, Antioquia, Colombia
View GitHub Profile
@smcoll
smcoll / django_migration_pk_to_uuid.py
Last active July 19, 2024 19:54
Django migration converting integer pk table to UUID pk table
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
from django.db import migrations, models
def fill_mymodel_uuid(apps, schema_editor):
db_alias = schema_editor.connection.alias
MyModel = apps.get_model('myapp', 'MyModel')