<NME> models.py
<BEF> """Transport models."""

import jsonfield
from reversion import revisions as reversion

from django.db import models
from django.utils.translation import ugettext_lazy as _

from . import backends


class Transport(models.Model):
    """Transport table."""

    pattern = models.CharField(
class Transport(models.Model):
    """Transport table."""

    pattern = models.CharField(_("pattern"), unique=True, max_length=254)
    service = models.CharField(_("service"), max_length=30)
    next_hop = models.CharField(_("next hop"), max_length=100, blank=True)


    def __str__(self):
        return self.pattern

    @property
    def backend(self):
        """Shortcut to access backend."""
        if not self.service:
            return None
        return backends.manager.get_backend(self.service)


reversion.register(Transport)

<MSG> transport: avoid index issues with MySQL/MariaDB.

See https://github.com/modoboa/modoboa-postfix-autoreply/issues/19

<DFF> @@ -16,7 +16,8 @@ from . import backends
 class Transport(models.Model):
     """Transport table."""
 
-    pattern = models.CharField(_("pattern"), unique=True, max_length=254)
+    pattern = models.CharField(
+        _("pattern"), unique=True, max_length=253, db_index=True)
     service = models.CharField(_("service"), max_length=30)
     next_hop = models.CharField(_("next hop"), max_length=100, blank=True)
 

transport: avoid index issues with MySQL/MariaDB.