> Am 31.05.2019 um 13:15 schrieb Axel Rau <
Axel...@chaos1.de>:
>
> is it posible to bundle 2 AddField migrations with one RunPython?
> How should I arrange the state_operations in this case?
>
> The following migration does not work.
It seems, the variant below does the job.
However there is no state operation for undoing the migration.
Axel
- - -
class Migration(migrations.Migration):
dependencies = [
('erdb', '0007_add_customer_group'),
]
operations = [
migrations.RunPython(forwards_func, reverse_code=reverse_func),
migrations.SeparateDatabaseAndState(
database_operations=[],
state_operations=[
migrations.AddField(
model_name='account',
name='is_account_admin',
field=models.BooleanField(
db_column='is_account_admin',
default=False),
),
migrations.AddField(
model_name='account',
name='self_admin_only',
field=models.BooleanField(
db_column='self_admin_only',
default=False),
),
],
)
]
- - -