Re: How to fix a column typo in django

2011-04-18 Thread ravi krishna
You can do this by altering the table through SQL console (if your database
is sql). The commands to do the job for you is :

*mysql -u root -p*
*
use database_name*;

//eg:-for adding new column email to table
ALTER TABLE table_name ADD email VARCHAR(200);

//for modifying a column
ALTER TABLE table_name
MODIFY column_name column_type;

Thanks & Regards,

Ravi Krishna
My profiles: [image:
Facebook] [image:
LinkedIn]  [image:
Twitter] 




On Tue, Apr 19, 2011 at 5:10 AM, Kenneth Gonsalves
wrote:

> On Mon, 2011-04-18 at 16:11 +0200, Kann Vearasilp wrote:
> > That was one of my idea, but what if the table has already been
> > populated
> > and I don't want to lose the data in the table?
> >
> > Can I just change the column name manually using SQL and modify the
> > models.py afterwards?
>
> that is the recommended way. you can also use a migration tool like
> south
> --
> regards
> KG
> http://lawgon.livejournal.com
> Coimbatore LUG rox
> http://ilugcbe.techstud.org/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to fix a column typo in django

2011-04-18 Thread Kenneth Gonsalves
On Mon, 2011-04-18 at 16:11 +0200, Kann Vearasilp wrote:
> That was one of my idea, but what if the table has already been
> populated
> and I don't want to lose the data in the table?
> 
> Can I just change the column name manually using SQL and modify the
> models.py afterwards? 

that is the recommended way. you can also use a migration tool like
south
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to fix a column typo in django

2011-04-18 Thread Shawn Milochik
You can use South.

south.aeracode.org

You'd create a schema migration to create the new field, then a data
migration to populate the new field from the old, then another schema
migration to remove the original field.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to fix a column typo in django

2011-04-18 Thread Anurag Chourasia
Yes. That should be doable.

If you are on Oracle, you could manually change the Column Name using
the following Syntax (If you are on a different Database than Oracle
then the Syntax might differ but still doable).

ALTER TABLE  RENAME COLUMN  TO 

And later you could change the models.py manually to reflect the New
Column Name.

Regards,
Anurag

On Mon, Apr 18, 2011 at 7:41 PM, Kann Vearasilp  wrote:
> Hi Anurag,
>
> That was one of my idea, but what if the table has already been populated
> and I don't want to lose the data in the table?
>
> Can I just change the column name manually using SQL and modify the
> models.py afterwards?
>
> Kann
>
> On Mon, Apr 18, 2011 at 4:06 PM, Anurag Chourasia
>  wrote:
>>
>> Hi Kann,
>>
>> Does Dropping the Table and Recreating using SyncDB work well in your
>> setup?
>>
>> Regards,
>> Anurag
>>
>> On Mon, Apr 18, 2011 at 7:30 PM, Kann  wrote:
>> > Dear all,
>> >
>> > I am new to django and have question about fixing the typo i made in
>> > the models.py. For example, I created tables with typo in the column
>> > name. So, I didn't realized the mistake and run the 'python manage.py
>> > syncdb' which created the tables with the incorrect names. Later I
>> > realized the typos and made changes in the "models.py" file and run
>> > the "python manage.py syncdb" again, but it didn't fix the typo in my
>> > column names.
>> >
>> > How do i fix the mistakes in the column names after the 'syncdb' is
>> > already run?
>> >
>> > Best,
>> >
>> > Kann
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to fix a column typo in django

2011-04-18 Thread Kann Vearasilp
Hi Anurag,

That was one of my idea, but what if the table has already been populated
and I don't want to lose the data in the table?

Can I just change the column name manually using SQL and modify the
models.py afterwards?

Kann

On Mon, Apr 18, 2011 at 4:06 PM, Anurag Chourasia <
anurag.choura...@gmail.com> wrote:

> Hi Kann,
>
> Does Dropping the Table and Recreating using SyncDB work well in your
> setup?
>
> Regards,
> Anurag
>
> On Mon, Apr 18, 2011 at 7:30 PM, Kann  wrote:
> > Dear all,
> >
> > I am new to django and have question about fixing the typo i made in
> > the models.py. For example, I created tables with typo in the column
> > name. So, I didn't realized the mistake and run the 'python manage.py
> > syncdb' which created the tables with the incorrect names. Later I
> > realized the typos and made changes in the "models.py" file and run
> > the "python manage.py syncdb" again, but it didn't fix the typo in my
> > column names.
> >
> > How do i fix the mistakes in the column names after the 'syncdb' is
> > already run?
> >
> > Best,
> >
> > Kann
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to fix a column typo in django

2011-04-18 Thread Anurag Chourasia
Hi Kann,

Does Dropping the Table and Recreating using SyncDB work well in your setup?

Regards,
Anurag

On Mon, Apr 18, 2011 at 7:30 PM, Kann  wrote:
> Dear all,
>
> I am new to django and have question about fixing the typo i made in
> the models.py. For example, I created tables with typo in the column
> name. So, I didn't realized the mistake and run the 'python manage.py
> syncdb' which created the tables with the incorrect names. Later I
> realized the typos and made changes in the "models.py" file and run
> the "python manage.py syncdb" again, but it didn't fix the typo in my
> column names.
>
> How do i fix the mistakes in the column names after the 'syncdb' is
> already run?
>
> Best,
>
> Kann
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to fix a column typo in django

2011-04-18 Thread Kann
Dear all,

I am new to django and have question about fixing the typo i made in
the models.py. For example, I created tables with typo in the column
name. So, I didn't realized the mistake and run the 'python manage.py
syncdb' which created the tables with the incorrect names. Later I
realized the typos and made changes in the "models.py" file and run
the "python manage.py syncdb" again, but it didn't fix the typo in my
column names.

How do i fix the mistakes in the column names after the 'syncdb' is
already run?

Best,

Kann

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.