create table Car (
id bigint not null auto_increment,
primary key (id)
) ENGINE=InnoDB
create table Part (
id bigint not null auto_increment,
primary key (id)
) ENGINE=InnoDB
create table Car_Part (
Car_id bigint not null,
parts_id bigint not null
) ENGINE=InnoDB
alter table Car_Part
drop constraint UK_dlk3oyy9nxup2nhflu77chryv
alter table Car_Part
add constraint UK_dlk3oyy9nxup2nhflu77chryv unique (parts_id)
alter table Car_Part
add constraint FK_dlk3oyy9nxup2nhflu77chryv
foreign key (parts_id)
references Part (id)
alter table Car_Part
add constraint FK_r68570aqu4i9syak3l4fte2ht
foreign key (Car_id)
references Car (id)