Displaying 1 result from an estimated 1 matches for "fk_category_id".
2005 Jul 25
2
acts_as_tree and traversing parent/child relationships
...a pretty complex
category structure through out the site. I have defined a table to
house all the info and a FK to reference parents within the table
CREATE TABLE categories (
id int(11) NOT NULL auto_increment,
name varchar(50) NOT NULL,
parent_id int(11) default NULL,
constraint fk_category_id foreign key (category_id) references
categories(id),
PRIMARY KEY (id)
);
My goal was to be able to set the names to reference other entries in
the table, establishing the parent/child relationship
parent = id: 1 name: Category 1 parent_id: NULL
child = id: 2 name: child 1 parent_id: 1
chi...