Re: How do you use dbshell ALTER TABLE correctly?

2013-08-15 Thread Pepsodent Cola
When I try the entire thing I get the below error message.  What am I doing 
wrong?

sqlite> ALTER TABLE navi_polls_altword ADD COLUMN "wordy2_id" integer NOT 
NULL PRIMARY KEY REFERENCES "navi_polls_word" ("id") DEFAULT '';
Error: Cannot add a PRIMARY KEY column




On Thursday, August 15, 2013 10:30:01 PM UTC+2, Pepsodent Cola wrote:
>
> I found this example on a Stack Overflow webpage.  But I'm not sure if I did 
> things correctly?
>
>
> $ python manage.py dbshell> ALTER TABLE  ADD COLUMN 
>  DEFAULT '';
>
>
>
> $ python manage.py sqlall navi_polls
>
> CREATE TABLE "navi_polls_altword" (
> "rosword_id" integer NOT NULL REFERENCES "navi_polls_word" ("id"),
> "wordy_id" integer NOT NULL PRIMARY KEY REFERENCES 
> "navi_polls_word" ("id"),
> );
>
>
>
> Is this the correct syntax?  Because things at admin page doesn't behave 
> 100% normal.
>
> sqlite> ALTER TABLE navi_polls_altword ADD COLUMN "wordy_id" integer NOT 
> NULL DEFAULT '';
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


How do you use dbshell ALTER TABLE correctly?

2013-08-15 Thread Pepsodent Cola


I found this example on a Stack Overflow webpage.  But I'm not sure if I did 
things correctly?


$ python manage.py dbshell> ALTER TABLE  ADD COLUMN 
 DEFAULT '';



$ python manage.py sqlall navi_polls

CREATE TABLE "navi_polls_altword" (
"rosword_id" integer NOT NULL REFERENCES "navi_polls_word" ("id"),
"wordy_id" integer NOT NULL PRIMARY KEY REFERENCES 
"navi_polls_word" ("id"),
);



Is this the correct syntax?  Because things at admin page doesn't behave 
100% normal.

sqlite> ALTER TABLE navi_polls_altword ADD COLUMN "wordy_id" integer NOT 
NULL DEFAULT '';

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.