Questions tagged [django-south]

Tool to provide consistent, easy-to-use and database-agnostic database migrations for Django applications. Deprecated since Django 1.7.

South was a tool to provide consistent, easy-to-use and database-agnostic s for applications.

Since Django 1.7, the features previously provided by South are included directly in Django.

1022 questions
220
votes
3 answers

Backwards migration with Django South

Ok, so this seems like a really silly thing to ask, and I'm sure I'm missing something somewhere. How do you perform a backwards migration using South on Django? So I've tweaked my models, created a migration with schemamigration, run the migration…
Ruiwen
  • 2,325
  • 2
  • 16
  • 12
216
votes
6 answers

Django - How to rename a model field using South?

I would like to change a name of specific fields in a model: class Foo(models.Model): name = models.CharField() rel = models.ForeignKey(Bar) should change to: class Foo(models.Model): full_name = models.CharField() odd_relation…
Jonathan Livni
  • 101,334
  • 104
  • 266
  • 359
189
votes
8 answers

Django South - table already exists

I am trying to get started with South. I had an existing database and I added South (syncdb, schemamigration --initial). Then, I updated models.py to add a field and ran ./manage.py schemamigration myapp --auto. It seemed to find the field and said…
Steve
  • 2,225
  • 2
  • 16
  • 8
155
votes
7 answers

What's the recommended approach to resetting migration history using Django South?

I've accumulated quite a few migrations using South (0.7) and Django (1.1.2) which are starting to consume quite a bit of time in my unit tests. I would like to reset the baseline and start a fresh set of migrations. I've reviewed the South…
Glenn Snyder
  • 1,768
  • 3
  • 12
  • 9
143
votes
4 answers

Easiest way to rename a model using Django/South?

I've been hunting for an answer to this on South's site, Google, and SO, but couldn't find a simple way to do this. I want to rename a Django model using South. Say you have the following: class Foo(models.Model): name =…
vaughnkoch
  • 1,779
  • 2
  • 13
  • 17
133
votes
7 answers

How do I migrate a model out of one django app and into a new one?

I have a django app with four models in it. I realize now that one of these models should be in a separate app. I do have south installed for migrations, but I don't think this is something it can handle automatically. How can I migrate one of the…
Apreche
  • 30,042
  • 8
  • 41
  • 52
94
votes
3 answers

django 1.7 migrate gets error "table already exists"

I am trying to apply a migration but am getting the error: django.db.utils.OperationalError: (1050, "Table 'customers_customer' already exists") I get this by issuing the following command: python manage.py migrate My customer table already…
Atma
  • 29,141
  • 56
  • 198
  • 299
92
votes
13 answers

How to reset migrations in Django 1.7

(I know there is a title the same as this, but the question is different). I have managed to get my development machine migrations and production migrations out of sync. I have a Django app which was using South. I had my own workflow that worked…
wobbily_col
  • 11,390
  • 12
  • 62
  • 86
84
votes
11 answers

migrating django-model field-name change without losing data

I have a django project with a database table that already contains data. I'd like to change the field name without losing any of the data in that column. My original plan was to simply change the model field name in a way that would not actually…
sfletche
  • 47,248
  • 30
  • 103
  • 119
78
votes
6 answers

Why don't my south migrations work?

First, I create my database. create database mydb; I add "south" to installed Apps. Then, I go to this tutorial: http://south.aeracode.org/docs/tutorial/part1.html The tutorial tells me to do this: $ py manage.py schemamigration wall…
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
72
votes
5 answers

Adding new custom permissions in Django

I am using custom permissions in my Django models like this: class T21Turma(models.Model): class Meta: permissions = (("can_view_boletim", "Can view boletim"), ("can_view_mensalidades", "Can view…
gerdemb
  • 11,275
  • 17
  • 65
  • 73
66
votes
9 answers

django no such table:

I have models in Django set up as below. class Pupil(models.Model): forename = models.CharField(max_length=30) surname = models.CharField(max_length=30) dateofbirth = models.DateField() year = models.IntegerField() class_group =…
puffin
  • 1,331
  • 4
  • 15
  • 18
65
votes
9 answers

Django 1.8 - what's the difference between migrate and makemigrations?

According to the documentation here: https://docs.djangoproject.com/en/1.8/topics/migrations/ it says: migrate, which is responsible for applying migrations, as well as unapplying and listing their status. and makemigrations, which is responsible…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
57
votes
1 answer

Can you migrate backwards to before the first migration in South?

Can you migrate an app backwards to before its first migration in Django South? If not, are there plans to add such functionality, perhaps using an option passed to migrate?
CJ Gaconnet
  • 1,421
  • 1
  • 12
  • 18
56
votes
10 answers

What is the best approach to change primary keys in an existing Django app?

I have an application which is in BETA mode. The model of this app has some classes with an explicit primary_key. As a consequence Django use the fields and doesn't create an id automatically. class Something(models.Model): name =…
luc
  • 41,928
  • 25
  • 127
  • 172
1
2 3
68 69