﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34351	Slash in constraint name results in invalid migration file naming	Simon Dupouy	nobody	"== Steps to reproduce:

1. create a model
{{{#!python
class TestModel(models.Model):
    foo = models.TextField()
    bar = models.TextField()
}}}
2. make and apply the initial migration
3. add a constraint with a forward slash in its name
{{{#!python
class TestModel(models.Model):
    foo = models.TextField()
    bar = models.TextField()

    class Meta:
        constraints = [
            models.UniqueConstraint(fields=['foo', 'bar'], name='foo/bar unique')
        ]
}}}
4. `makemigrations` and `migrate`

== Result
Django tries to create a migration file named `0002_testmodel_foo/bar unique.py`.
This results in the creation of the file `bar unique.py` in the directory `0002_testmodel_foo`.
Hence, the last `migrate` command doesn't work.

== Expected behavior
Creation of a migration file with a sanitized name, or a warning that the constraint name shouldn't contain special characters.

== Remark
All that the documentation says on constraint names is
  **BaseConstraint.name**
  The name of the constraint. You must always specify a unique name for the constraint.
It isn't stated that the naming of constraints must follow specific conventions."	Cleanup/optimization	closed	Migrations	4.1	Normal	duplicate	constraint name slash		Unreviewed	0	0	0	0	0	0
