Thanks,
On Wed, Mar 15, 2017 at 9:43 AM, Mike Dewhirst <mi...@dewhirst.com.au>
wrote:

> On 15/03/2017 7:12 PM, Stefano Tranquillini wrote:
>
>> Hi people.
>>
>> I've to do a migration for the database, specifically I've to rename a
>> table.
>>
>> To do so I've a RunPython that runs this sql statemnet
>> `ALTER TABLE "old_table" RENAME TO "new_table"`
>> First question: should I use https://docs.djangoproject.com
>> /en/1.8/ref/migration-operations/#renamemodel , does it do the same?
>>
>
> I believe it does the same ... certainly worked for me with Postgres. Make
> an empty migration.
>
>     operations = [
>
>         migrations.RenameModel('Oldname', 'Newname'),
>
>         migrations.AlterModelTable('Newname', 'appname_newname'),
>
>     ]
>
>
​the fact is that when i do renameModel it tells me that "No installed app
with label.." but if run the sql statment as above it works.
in your operations there is also the alter model, why so?​



>
> Will these operation update all the refrences in the code, such that
>> django will keep working without problems?
>>
>
> Definitely not.
>
>
​I probably asked the worng question. I was trying to infeer if references
in the DB will be updated as well.​



-- 
Stefano

-- 
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/CAPQ1%3DkCRp5XFGzRmCUE7H1Hq%3DPD1_MAkw3kND%2BXD-m0%2BexDL-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to