Thanks for responding Shawn,

I am using south, and have tried using a schemamigration --auto on the
database...
I get the error:

? The field 'Photo_Log.sample_id' does not have a default specified,
yet is NOT NULL.
 ? Since you are removing this field, you MUST specify a default
 ? value to use for existing rows. Would you like to:
 ?  1. Quit now, and add a default to the field in models.py
 ?  2. Specify a one-off value to use for existing columns now
 ?  3. Disable the backwards migration by raising an exception.

I tried 2 things without success, and continued to get this same error
message.

1. With the postgresql table defining the sample_id as NOT NULL, I set
the default=0 in the model definition for this foreign key
e.g. sample = models.ForeignKey(Sample, verbose_name='Sample Name',
default=0).

2. Removed the postgresql NOT NULL constraint on the column sample_id
and set the model definition to:
e.g. sample = models.ForeignKey(Sample, verbose_name='Sample Name').

I get the same error regardless??






On May 18, 12:55 pm, Shawn Milochik <sh...@milochik.com> wrote:
> You have three choices.
>
> 1. Use South. #1 recommendation by me.http://south.aeracode.org/
>
> 2. Delete your entire database and do another syncdb.
>
> 3. Write SQL manually to fix your database (don't do this).
>
> The reason is that, once you do syncdb and a table is created, running
> syncdb will never again touch that table. You need a schema migration
> tool (South) for that.
>
> Note that if you decide to use South and want to keep your existing
> data, you'll have to revert your models.py to the state it was in during
> the initial syncdb, create your 'initial' south migration, then make the
> changes. Then you'll be able to use South to automatically create a
> migration.
>
> 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.

Reply via email to