Saturday, March 31, 2012

Re: modifying generated create table scripts and ise sync db?

Hello Kasun,

I hope the following link helps.
https://docs.djangoproject.com/en/1.4/ref/models/fields/#primary-key

Thanks.

2012/3/31 KasunLak <kasun.lakpriya86@gmail.com>
This is a oracle create table statements for what I wanted to do in
django. How to get a relationship like this in django model. Is there
a way to manually modify the generated create table statements in
django to fulfil our needs. eg: removing id column, make one column a
primary key of another like below. Thank you. Though the following are
from Oracle I want to do it in mysql. this is just to show what I want
to get.

CREATE TABLE user_tab
     ( mobileno                        VARCHAR2       NOT NULL,
       name_                          VARCHAR2       NOT NULL,
       town_                          VARCHAR2       NOT NULL,
       contact_no                     VARCHAR2       NOT NULL)
TABLESPACE &pola_data
STORAGE (&normal)
/


ALTER TABLE user_tab
  ADD ( CONSTRAINT user_pk PRIMARY KEY (mobileno)
        USING INDEX
              TABLESPACE &pola_index
              STORAGE (&normal))
/

--
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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment