refactor(terminal): 去掉 Session 中 Terminal 的外键关系

pull/4924/head
xinwen 4 years ago committed by 老广
parent ab77d5db4b
commit 9d9177ed05

@ -0,0 +1,19 @@
# Generated by Django 2.2.13 on 2020-11-02 08:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('terminal', '0026_auto_20201027_1905'),
]
operations = [
migrations.AlterField(
model_name='session',
name='terminal',
field=models.ForeignKey(db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='terminal.Terminal'),
),
]

@ -198,7 +198,7 @@ class Session(OrgModelMixin):
is_finished = models.BooleanField(default=False, db_index=True) is_finished = models.BooleanField(default=False, db_index=True)
has_replay = models.BooleanField(default=False, verbose_name=_("Replay")) has_replay = models.BooleanField(default=False, verbose_name=_("Replay"))
has_command = models.BooleanField(default=False, verbose_name=_("Command")) has_command = models.BooleanField(default=False, verbose_name=_("Command"))
terminal = models.ForeignKey(Terminal, null=True, on_delete=models.SET_NULL) terminal = models.ForeignKey(Terminal, null=True, on_delete=models.DO_NOTHING, db_constraint=False)
protocol = models.CharField(choices=PROTOCOL.choices, default='ssh', max_length=16, db_index=True) protocol = models.CharField(choices=PROTOCOL.choices, default='ssh', max_length=16, db_index=True)
date_start = models.DateTimeField(verbose_name=_("Date start"), db_index=True, default=timezone.now) date_start = models.DateTimeField(verbose_name=_("Date start"), db_index=True, default=timezone.now)
date_end = models.DateTimeField(verbose_name=_("Date end"), null=True) date_end = models.DateTimeField(verbose_name=_("Date end"), null=True)

Loading…
Cancel
Save