0029_save_board_pk_in_tmp.py 685 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Generated by Django 2.0.8 on 2018-09-01 15:13

from django.db import migrations


def migrate_to(apps, schema_editor):
    Board = apps.get_model("activemembers", "Board")
    TemporaryBoard = apps.get_model("activemembers", "TemporaryBoard")

    boards = Board.objects.all()
    for board in boards:
        TemporaryBoard.objects.create(parent=board.committee_ptr_id)

def migrate_back(apps, schema_editor):
    # Reverse is not imported, objects will be deleted
    pass

class Migration(migrations.Migration):

    dependencies = [
        ('activemembers', '0028_create_tmp_board_model'),
    ]

    operations = [
        migrations.RunPython(migrate_to, migrate_back),
    ]