Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created February 21, 2014 16:12
Show Gist options
  • Save shofetim/9137134 to your computer and use it in GitHub Desktop.
Save shofetim/9137134 to your computer and use it in GitHub Desktop.
South trying to change Piece.barcode ?
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Piece.unsortable'
db.add_column('warehouse_pieces_piece', 'unsortable',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
# Adding field 'Piece.barcode_absent'
db.add_column('warehouse_pieces_piece', 'barcode_absent',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
# Changing field 'Piece.barcode'
db.alter_column('warehouse_pieces_piece', 'barcode_id', self.gf('warehouse_pieces.models.ForeignKeySaveForm')(null=True, on_delete=models.SET_NULL, to=orm['barcodes.Barcode']))
def backwards(self, orm):
# Deleting field 'Piece.unsortable'
db.delete_column('warehouse_pieces_piece', 'unsortable')
# Deleting field 'Piece.barcode_absent'
db.delete_column('warehouse_pieces_piece', 'barcode_absent')
# Changing field 'Piece.barcode'
db.alter_column('warehouse_pieces_piece', 'barcode_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, on_delete=models.SET_NULL, to=orm['barcodes.Barcode']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment