diff --git a/smash/web/migrations/0046_subject_flying_team.py b/smash/web/migrations/0046_subject_flying_team.py
new file mode 100644
index 0000000000000000000000000000000000000000..3101c686d80256eb03b7d5e27e76f30ea5f65ff7
--- /dev/null
+++ b/smash/web/migrations/0046_subject_flying_team.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-09-11 10:07
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('web', '0045_holiday_info'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='subject',
+            name='flying_team',
+            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='web.FlyingTeam', verbose_name=b'Flying team (if applicable)'),
+        ),
+    ]
diff --git a/smash/web/migrations/0047_subject_flying_team_from_annotation.py b/smash/web/migrations/0047_subject_flying_team_from_annotation.py
new file mode 100644
index 0000000000000000000000000000000000000000..7b514e537ecdda24e2882e9a6b1557abf317a375
--- /dev/null
+++ b/smash/web/migrations/0047_subject_flying_team_from_annotation.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# assigns default flying team location for subjects that had in the past finished appointment at flying team location
+
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ('web', '0046_subject_flying_team'),
+    ]
+
+    operations = [
+        migrations.RunSQL(
+            "update web_subject set flying_team_id = web_appointment.flying_team_id from web_visit, web_appointment " +
+            "where web_subject.id=web_visit.subject_id and " +
+            "web_subject.flying_team_id is null and " +
+            "web_visit.id = web_appointment.visit_id and " +
+            "web_appointment.flying_team_id is not null and status = 'FINISHED';"
+        ),
+    ]