Skip to content

Commit

Permalink
Problem: plugin is not compatible with MariaDB
Browse files Browse the repository at this point in the history
Solution: make database schema copmatible with MariaDB

This patch switches TestFields to CharFields where an index is needed on that field.

fixes: #4909
https://pulp.plan.io/issues/4909
  • Loading branch information
dkliban committed Jun 4, 2019
1 parent 74d5ada commit ecd12cf
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pulp_rpm/app/models.py
Expand Up @@ -4,7 +4,7 @@
import createrepo_c as cr

from django.db import models
from pulpcore.plugin.models import Content, Remote, Publication, PublicationDistribution
from pulpcore.plugin.models import Content, Model, Remote, Publication, PublicationDistribution

from pulp_rpm.app.constants import (CHECKSUM_CHOICES, CREATEREPO_PACKAGE_ATTRS,
CREATEREPO_UPDATE_COLLECTION_ATTRS,
Expand Down Expand Up @@ -113,14 +113,14 @@ class Package(Content):
TYPE = 'package'

# Required metadata
name = models.TextField()
epoch = models.TextField()
version = models.TextField()
release = models.TextField()
arch = models.TextField()
name = models.CharField(max_length=255)
epoch = models.CharField(max_length=255)
version = models.CharField(max_length=255)
release = models.CharField(max_length=255)
arch = models.CharField(max_length=255)

pkgId = models.TextField(unique=True) # formerly "checksum" in Pulp 2
checksum_type = models.TextField(choices=CHECKSUM_CHOICES)
pkgId = models.CharField(unique=True, max_length=255) # formerly "checksum" in Pulp 2
checksum_type = models.CharField(choices=CHECKSUM_CHOICES, max_length=255)

# Optional metadata
summary = models.TextField()
Expand Down Expand Up @@ -389,7 +389,7 @@ class UpdateRecord(Content):
TYPE = 'advisory'

# Required metadata
id = models.TextField(db_index=True)
id = models.CharField(max_length=255, db_index=True)
updated_date = models.TextField()

# Optional metadata
Expand All @@ -412,7 +412,7 @@ class UpdateRecord(Content):
# A field that represents the hash digest of the update record. Used to track differences
# between two UpdateRecord objects without having to examine the associations like
# UpdateCollection or UpdateCollectionPackage.
digest = models.TextField(unique=True)
digest = models.CharField(unique=True, max_length=64)

@classmethod
def natural_key_fields(cls):
Expand Down Expand Up @@ -460,7 +460,7 @@ def __init__(self, *args, **kwargs):
self._references = []


class UpdateCollection(models.Model):
class UpdateCollection(Model):
"""
A collection of UpdateCollectionPackages with an associated nametag.
Expand Down Expand Up @@ -510,7 +510,7 @@ def __init__(self, *args, **kwargs):
self._packages = []


class UpdateCollectionPackage(models.Model):
class UpdateCollectionPackage(Model):
"""
Part of an UpdateCollection, representing a package.
Expand Down Expand Up @@ -585,7 +585,7 @@ def createrepo_to_dict(cls, package):
}


class UpdateReference(models.Model):
class UpdateReference(Model):
"""
A reference to the additional information about the problem solved by an update.
Expand Down

0 comments on commit ecd12cf

Please sign in to comment.