Is there a way to change a CharField to a TextField and keep the data from this column intact?
Right now I have the following:
class TestLog(models.Model):
failed_reqs = models.CharField(max_length=DB_MAX_CHAR_LENGTH, blank=True)
passed_reqs = models.CharField(max_length=DB_MAX_CHAR_LENGTH, blank=True)
But the DB_MAX_CHAR_LENGTH is 500, and as it turns out this field can sometimes exceed that, so I want to go to:
class TestLog(models.Model):
failed_reqs = models.TextField(blank=True)
passed_reqs = models.TextField(blank=True)
How do I do this and keep my data intact on the production database?
Djangobook details how to add and remove fields, and I’ve tried using South to do this as well, but South gave me an error, and looking at the output from before the error it appears as though South is dropping and recreating the DB. Is this what south’s data migrations is all about?
Assuming that you have access to the database, as you mentioned the way Django talks about adding and removing columns, I’ve listed methods for both Postgresql and MySQL since you didn’t mention what you were using.
I would highly recommend backing up your database before doing these changes.