35 lines
769 B
Python
35 lines
769 B
Python
# Generated by Django 3.1.3 on 2020-11-21 23:54
|
|
|
|
from django.db import migrations, models
|
|
import uuid
|
|
|
|
|
|
def add_uuids(apps, schema_editor):
|
|
Thought = apps.get_model("thoughts", "Thought")
|
|
for thought in Thought.objects.all():
|
|
thought.uuid = uuid.uuid4()
|
|
thought.save()
|
|
|
|
|
|
def reverse_add_uuids(apps, schema_editor):
|
|
pass
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('thoughts', '0002_auto_20200906_0324'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='thought',
|
|
name='uuid',
|
|
field=models.UUIDField(default=uuid.uuid4, editable=False),
|
|
),
|
|
migrations.RunPython(
|
|
add_uuids,
|
|
reverse_code=reverse_add_uuids
|
|
)
|
|
]
|