"Ramiro Morales" <[EMAIL PROTECTED]> writes:

> On 2/10/07, David Abrahams <[EMAIL PROTECTED]> wrote:
>>
>> Whatever django bugs may be lurking asid, I need to move forward with
>> my project ASAP so I'd really appreciate it if someone could give me a
>> few hints about how to evolve my existing DB (which was created
>> without the primary_key=True and (I think) also without null=True) so
>> I can still use the data.
>
> Disclamer: I know almost nothing about databases.
>
> Oh, this is a (new) hint. You are not sure if you created your data
> when the Session -> Track ForeignKey had null=True?  If it hadn' t
> and you are now trying to modify it it to use that option without
> also modifying the DB, it's not that strange you are getting errors.

Yes, I'm aware of that.  That's why I asked for help evolving the DB.

> You could confirm that by examining the table stucture. Use:
>
> $ ./manage.py sql program
>
> twice, once without null=True and once with null=True, to see the difference
> and eventually create the ALTER TABLE SQL sentence to modify to reflect
> the change you' ve made to your model without losing your valuable data.

Good trick, thanks.

> This is using sqlite3:
>
> --- nonull.txt  2007-02-10 19:29:23.000000000 -0300
> +++ nulltrue.txt        2007-02-10 19:28:48.000000000 -0300
> @@ -13,13 +13,13 @@
>  CREATE TABLE "program_session" (
>      "id" integer NOT NULL PRIMARY KEY,
>      "title" varchar(200) NOT NULL,
>      "short_title" varchar(50) NOT NULL,
>      "description" text NOT NULL,
>      "start_id" integer NOT NULL REFERENCES "program_timedivision" ("id"),
> -    "track_id" integer NOT NULL REFERENCES "program_track" ("id"),
> +    "track_id" integer NULL REFERENCES "program_track" ("id"),
>      "duration" time NOT NULL,
>      UNIQUE ("start_id", "track_id"),
>      UNIQUE ("title")
>  );
>  CREATE TABLE "program_speaker" (
>      "id" integer NOT NULL PRIMARY KEY,

Super; thanks for your help!

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to