add unique constraint on name + hostmask
I'm thinking that the command to log out will be LOGOUT <name>, which means the user hostmask must have an unambiguous link to name Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
parent
ab9690fa1c
commit
34aa91ad9e
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 5.0.5 on 2024-05-10 18:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('idlerpg', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='character',
|
||||||
|
constraint=models.UniqueConstraint(models.F('name'), models.F('hostmask'), name='player_must_have_unique_character_names'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -121,6 +121,7 @@ class Character(models.Model):
|
||||||
constraints = [
|
constraints = [
|
||||||
models.UniqueConstraint("game", "hostmask", name="one_player_character_per_game"),
|
models.UniqueConstraint("game", "hostmask", name="one_player_character_per_game"),
|
||||||
models.UniqueConstraint("game", "name", name="no_characters_with_same_name_per_game"),
|
models.UniqueConstraint("game", "name", name="no_characters_with_same_name_per_game"),
|
||||||
|
models.UniqueConstraint("name", "hostmask", name="player_must_have_unique_character_names"),
|
||||||
]
|
]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
Loading…
Reference in New Issue