Skip to content

Commit

Permalink
Merge pull request #175 from monzo/mattrco/comms-channel-dupe
Browse files Browse the repository at this point in the history
Enforce 1-to-1 relation between Incident and Comms Channel
  • Loading branch information
mattrco authored Oct 24, 2019
2 parents abc361c + b0291f4 commit ed1f72f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions response/migrations/0012_commschannel_onetoone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.3 on 2019-10-24 14:55

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [("response", "0011_auto_20190927_1339")]

operations = [
migrations.AlterField(
model_name="commschannel",
name="incident",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to="response.Incident"
),
)
]
2 changes: 1 addition & 1 deletion response/slack/models/comms_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create_comms_channel(self, incident):
class CommsChannel(models.Model):

objects = CommsChannelManager()
incident = models.ForeignKey(Incident, on_delete=models.CASCADE)
incident = models.OneToOneField(Incident, on_delete=models.CASCADE)
channel_id = models.CharField(max_length=20, null=False)
channel_name = models.CharField(max_length=80, null=False)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from setuptools import find_packages, setup

VERSION = "0.1.19"
VERSION = "0.1.20"

INSTALL_REQUIRES = [
"Django>=2.2",
Expand Down

0 comments on commit ed1f72f

Please sign in to comment.