Opened 8 years ago

Last modified 4 years ago

#27871 closed Bug

Django keeps making the same migration over and over again — at Version 5

Reported by: Kyle Agronick Owned by: nobody
Component: Migrations Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Kyle Agronick)

Here are all the models:

from django.contrib.auth.models import User
from django.db import models

job_state = (('P', 'Pending'), ('A', 'Active'), ('C', 'Completed'), ('F', 'Failed'))
app_type = (('R', 'RX'), ('W', 'WAR'))
server_types = #taken out


class JobGroup(models.Model):
    job_type = models.CharField(max_length=100, db_index=True)
    created_by = models.ForeignKey(User)
    queued_date = models.DateTimeField(null=True, db_index=True)
    created_date = models.DateTimeField(auto_now_add=True, db_index=True)


class JobParameter(models.Model):
    job_group = models.ForeignKey(JobGroup, related_name='job_param', on_delete=models.CASCADE)
    name = models.CharField(max_length=100, db_index=True)
    value = models.TextField()

    def split_values(self):
        if ',' in self.value and isinstance(self.value, str):
            return self.value.split(', ')
        else:
            return [self.value]

    class Meta:
        unique_together = ('job_group', 'name')


class Job(models.Model):
    job_group = models.ForeignKey(JobGroup, related_name='jobs', on_delete=models.CASCADE)
    state = models.CharField(max_length=1, choices=job_state, default='P', db_index=True)
    start_date = models.DateTimeField(null=True, db_index=True)
    end_date = models.DateTimeField(null=True)
    store = models.CharField(max_length=40, db_index=True)
    payload = models.TextField()

    def get_full_state(self):
        return self.get_state_display() if self.state in dict(job_state) else 'Unknown'

    class Meta:
        permissions = (
            ('deployment_job', 'Access Deployment job'),
            ('services_job', 'Access System Services job'),
            ('offline_status_job', 'Access Offline Status job'),
        )


class JobLog(models.Model):
    job = models.ForeignKey(Job, related_name='logs', on_delete=models.CASCADE)
    command = models.TextField()
    command_output = models.TextField()
    result = models.BooleanField(default=False)


class Service(models.Model):
    service_name = models.CharField(max_length=40)
    human_readable_name = models.CharField(max_length=40)
    server_type = models.CharField(choices=server_types, max_length=5)

    def __str__(self):
        return self.human_readable_name

    class Meta:
        ordering = ['human_readable_name']
        unique_together = ['service_name', 'server_type']

Change History (6)

by Kyle Agronick, 8 years ago

Attachment: migrations.tar.gz added

Migrations for the affected app

comment:1 by Kyle Agronick, 8 years ago

Description: modified (diff)

comment:2 by Kyle Agronick, 8 years ago

Description: modified (diff)
Type: UncategorizedBug

comment:3 by Tim Graham, 8 years ago

Component: Database layer (models, ORM)Migrations

Could you please provide a minimal set of models that reproduces the issue? Did you change the case of any models recently (#27297)?

Last edited 8 years ago by Tim Graham (previous) (diff)

comment:4 by Tim Graham, 8 years ago

Resolution: needsinfo
Status: newclosed

comment:5 by Kyle Agronick, 8 years ago

Description: modified (diff)
Resolution: needsinfo
Status: closednew
Note: See TracTickets for help on using tickets.
Back to Top