The trouble with fixtures has been fixed. It was caused by the existence of group_permissions including Oldname. As soon as I removed them everything is sweetness and light :)

I'm still interested in comments on sequences and indexes using Oldname embedded in their names even though it doesn't seem to affect anything.

Cheers

Mike

On 16/02/2016 1:27 PM, Mike Dewhirst wrote:
Hold on. I'm now having trouble with fixtures so please don't follow the recipe until I work it out. So far it seems only the table name has changed to Newname and it still uses all the Oldname sequences and indexes - which are owned by Newname.

Applications using Newname all work Ok.

Back to the drawing board. I'm now thinking creating a new table might be better and copying data the correct way to proceed.

Anyone else have any comments?

Thanks

Mike

On 15/02/2016 7:46 PM, Mike Dewhirst wrote:
I was postponing this but shouldn't have worried. Despite the complexities evident in various web recipes after googling, this is my simple recipe:

Python 2.7 and 3.4, Django 1.8 and Postgres 9.3 on Windows 8.1 and
Python 2.7, Django 1.8 and Postgres 9.1 on Ubuntu 12.04

1. Run all unit tests

2. Change model name to class Newname(...)

3. Resolve all the obvious issues by running the dev server, identify where things go wrong and repair them until the project software is mostly running with the Newname model. You may not get it to run but the dev server should not identify too many issues. Note, you may get the odd ProgrammingError - relation "Oldname" does not exist. Don't worry too much because you haven't renamed the table yet.

4. Create an empty migration using the --empty flag

5. Edit the empty operations list like this ...

operations = [
    migrations.RenameModel('Oldname', 'Newname')
    migrations.AlterModelTable('Newname', 'appname_newname'),
]

6. migrate

Note, you will probably need to or perhaps should delete stale content types at the end of the migration.

7. Run all unit tests

Thank you Sir Andrew and Django

Hope this helps someone

Mike





--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56C2C943.4000402%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to