Skip to content
Snippets Groups Projects
Commit a738de43 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

db changes for subject default flying team location

parent 06b0bdf0
No related branches found
No related tags found
1 merge request!62Resolve "subjects with flying team location should have default flying team location defined"
Pipeline #
# -*- 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)'),
),
]
# -*- 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';"
),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment