CREATE TABLE users (
    id bigserial NOT NULL,
    primary key (id)
);

CREATE TABLE wall_posts (
    id bigserial not null,
    user_id integer,
    foreign key (user_id) references users on delete cascade,
    primary key (id)
);;

CREATE TABLE wall_post_stars (
    wall_post_id integer NOT NULL,
    user_id integer NOT NULL,
    foreign key (wall_post_id) references wall_posts on delete cascade,
    foreign key (user_id) references users on delete cascade,
    primary key (user_id, wall_post_id)
);


On Sat, May 19, 2012 at 3:41 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:
> What's the fk setup there, do you have an FK column that is also a PK?
>
> Sent from my iPhone
>
> On May 19, 2012, at 7:24 AM, Ignas Mikalajunas <ignas.mikalaju...@gmail.com> 
> wrote:
>
>> Hi,
>>
>>>> A stack trace here would be extremely helpful.
>>
>> sorry forgot the error message for the traceback:
>>
>> NoReferencedColumnError: Could not create ForeignKey 'wall_posts.id'
>> on table 'wall_post_stars': table 'wall_posts' has no column named
>> 'id'
>>
>> Ignas
>>
>> --

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

Reply via email to