Tuesday, September 2, 2014

Re: Does Django detect changes in models Meta ?

OK, I found out that in order to change the schema of the tables one has to install and run a migration tool. I used south. just install south and check out their website for basic use and you basically run a few commands from the command line and it sees the changes you made and migrate the changes to your tables. I found that it does not work very well on sqlite3 Db, so I converted my DB to MYSQL and did that. 

Or find another migration tool other than south, but in order to update tables in Django, the easiest way is with a migration tool. And I found this all out via stackoverflow. :-)

thanks



On Fri, Aug 22, 2014 at 11:42 PM, Norman Bird <steelpulsefan@gmail.com> wrote:
how about: python manage.py sql myapp 
I just changed my model and I had to runt that in order to build the tables. 


On Fri, Aug 22, 2014 at 11:49 AM, Norman Bird <steelpulsefan@gmail.com> wrote:
I stand corrected. :-) 


On Fri, Aug 22, 2014 at 11:47 AM, Larry Martell <larry.martell@gmail.com> wrote:
On Fri, Aug 22, 2014 at 9:55 AM, Norman Bird <steelpulsefan@gmail.com> wrote:
> I am new, just completed the tutorials, but from my understanding you run
> "python manage.py syncdb" and that rebuilds the tables etc.

No, syncdb only create tables that do not exist. It does not alter any
existing tables.

>
> On Friday, August 22, 2014 3:32:43 AM UTC-4, termopro wrote:
>>
>> Hi there,
>>
>> I am using Django 1.7 RC2.
>> I have created models and have run all the migrations so Django created
>> tables in database.
>> Now i decided to change database table names and have added Meta class to
>> models containing table name:
>>
>> class SomeModel(models.Model):
>>    ...
>>    class Meta:
>>       db_table = 'newname'
>>
>> Now when i run "makemigrations" Django doesn't detect any changes in
>> models:
>> "No changes detected in app 'blabla'."
>> As far as i understand the logic, Django should change table names from
>> 'appname_somemodel" to "newname".
>>
>> Is this an expected behavior or i am missing something?

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/Yj6Guv0ch5k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY6SXWrzFVthSXGEMGbF2UmVaP1dMiO%2ByDc1W8Qy_28OSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Thank You,

Norman Bird
Principal Web Development Consultant
DatabaseInDays.com
(703) 986-7157




--
Thank You,

Norman Bird
Principal Web Development Consultant
DatabaseInDays.com
(703) 986-7157




--
Thank You,

Norman Bird
Principal Web Development Consultant
DatabaseInDays.com
(703) 986-7157

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAH_r61gA2tDtjhETuA4nN5AvzQOVah5Ygu4r5Z_8hV4_4m2k6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment