In that case, the primary key of the items table should be just subid, which would be a unique auto-incrementing key. itemid should be a foreign key to the baseitems table (as you have it now), but not part of the primary key for items. Then you set up a has_many in your basitems class and a has_a in your items class.