2020-11-30 18:32:54 +00:00
|
|
|
# Generated by Django 3.0.7 on 2020-11-30 19:39
|
|
|
|
|
|
|
|
import bookwyrm.models.fields
|
|
|
|
from django.db import migrations
|
|
|
|
|
2020-12-03 20:35:57 +00:00
|
|
|
def update_notnull(app_registry, schema_editor):
|
|
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
users = app_registry.get_model('bookwyrm', 'User')
|
|
|
|
for user in users.objects.using(db_alias):
|
|
|
|
if user.name and user.summary:
|
|
|
|
continue
|
|
|
|
if not user.summary:
|
|
|
|
user.summary = ''
|
|
|
|
if not user.name:
|
|
|
|
user.name = ''
|
|
|
|
user.save()
|
2020-11-30 18:32:54 +00:00
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('bookwyrm', '0018_auto_20201130_1832'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
2020-12-03 20:35:57 +00:00
|
|
|
migrations.RunPython(update_notnull),
|
2020-11-30 18:32:54 +00:00
|
|
|
migrations.AlterField(
|
|
|
|
model_name='user',
|
|
|
|
name='name',
|
|
|
|
field=bookwyrm.models.fields.CharField(default='', max_length=100),
|
|
|
|
),
|
|
|
|
migrations.AlterField(
|
|
|
|
model_name='user',
|
|
|
|
name='summary',
|
|
|
|
field=bookwyrm.models.fields.TextField(default=''),
|
|
|
|
),
|
|
|
|
]
|