/*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 21/03/2006 18:11:39 */ /*==============================================================*/ drop table if exists junks; drop table if exists tagmaps; drop table if exists tags; create table junks ( id int not null auto_increment, name varchar(255) not null, primary key (id) ) type = InnoDB; create table tagmaps ( id int not null auto_increment, junk_id int not null, tag_id int not null, primary key (id) ) type = InnoDB; create table tags ( id int not null auto_increment, name varchar(255) not null, primary key (id) ) type = InnoDB; alter table tagmaps add constraint fk_for_junk foreign key (junk_id) references junks(id) on delete restrict on update restrict; alter table tagmaps add constraint fk_tag foreign key (tag_id) references tags(id) on delete restrict on update restrict;