Source

django-fitlog / fitlog / migrations / 0002_timechange.py

Full commit
from south.db import db
from django.db import models
from fitlog.models import *


class Migration:

    def forwards(self, orm):

        # rename columns
        db.rename_column('fitlog_fitlog', 'total_time', 'total_time_orig')
        db.rename_column('fitlog_cardiofitlogdetail', 'total_time',
                         'total_time_orig')

        # Changing field 'FitLog.total_time'
        db.add_column('fitlog_fitlog', 'total_time',
                      models.TimeField(blank=True, null=True))

        # Changing field 'CardioFitLogDetail.total_time'
        db.add_column('fitlog_cardiofitlogdetail', 'total_time',
                      models.TimeField(blank=True, null=True))

    def backwards(self, orm):

        # delete the new columns
        db.delete_column('fitlog_fitlog', 'total_time')
        db.delete_column('fitlog_cardiofitlogdetail', 'total_time')

        # rename the originals back to what they were
        db.rename_column('fitlog_fitlog', 'total_time_orig', 'total_time')
        db.rename_column('fitlog_cardiofitlogdetail', 'total_time_orig',
                         'total_time')

    models = {
        'fitlog.musclegroup': {
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'name': ('models.CharField', [], {'max_length': '100'})
        },
        'fitlog.weightlogset': {
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'reps': ('models.SmallIntegerField', [], {}),
            'sequence': ('models.SmallIntegerField', [], {}),
            'weight': ('models.SmallIntegerField', [], {}),
            'weight_log_detail': ('models.ForeignKey', ['WeightFitLogDetail'],
                                  {})
        },
        'fitlog.fitlog': {
            'comments': ('models.TextField', [], {'max_length': '5000',
                                                  'blank': 'True'}),
            'create_date': ('models.DateTimeField', [],
                            {'auto_now_add': 'True'}),
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'last_update': ('models.DateTimeField', [], {'auto_now': 'True'}),
            'log_date': ('models.DateField', [], {}),
            'member': ('models.ForeignKey', ['User'], {}),
            'title': ('models.CharField', [], {'max_length': '255'}),
            'total_time': ('models.TimeField', [], {})
        },
        'fitlog.cardiofitlogdetail': {
            'comments': ('models.CharField', [], {'max_length': '500',
                                                  'blank': 'True'}),
            'distance': ('models.DecimalField', [], {'max_digits': '5',
                                                     'decimal_places': '1'}),
            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'total_time': ('models.TimeField', [], {})
        },
        'auth.user': {
            '_stub': True,
            'id': ('models.AutoField', [], {'primary_key': 'True'})
        },
        'fitlog.userprofile': {
            'gender': ('models.CharField', [], {'max_length': '1'}),
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'user': ('models.ForeignKey', ['User'], {'unique': 'True'})
        },
        'fitlog.weightfitlogdetail': {
            'comments': ('models.CharField', [], {'max_length': '500',
                                                  'blank': 'True'}),
            'exercise_type': ('models.ForeignKey', ['ExerciseType'], {}),
            'fit_log': ('models.ForeignKey', ['FitLog'], {}),
            'id': ('models.AutoField', [], {'primary_key': 'True'})
        },
        'fitlog.fitnesstype': {
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'name': ('models.CharField', [], {'max_length': '50'})
        },
        'fitlog.exercisetype': {
            'fitness_type': ('models.ForeignKey', ['FitnessType'], {}),
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'muscle_group': ('models.ForeignKey', ['MuscleGroup'],
                             {'null': 'True', 'blank': 'True'}),
            'name': ('models.CharField', [], {'max_length': '50'})
        },
        'fitlog.team': {
            'description': ('models.TextField', [],
                            {'max_length': '255', 'blank': 'True'}),
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
            'name': ('models.CharField', [], {'max_length': '50'})
        }
    }

    complete_apps = ['fitlog']