NYCPHP Meetup

NYPHP.org

[nycphp-talk] can't create foreign key constraints in schema -HELP!

Nasir Zubair lists at ny-tech.net
Wed Sep 10 03:05:41 EDT 2003


http://www.mysql.com/doc/en/ANSI_diff_Foreign_Keys.html states "In MySQL
Server 3.23.44 and up, InnoDB tables support checking of foreign key
constraints, including CASCADE, ON DELETE, and ON UPDATE."

Looking at the schema you gave, you are not creating "innoDB" tables.

For example, you will need to change the first table definition from this:

create table if not exists nnet_produkt_varegruppe (  
	nnet_produkt_varegruppe_id int not null auto_increment,
	primary key(nnet_produkt_varegruppe_id),
      nnet_produkt_varegruppe_navn varchar(255) not null 
	);

To this:

create table if not exists nnet_produkt_varegruppe (  
	nnet_produkt_varegruppe_id int not null auto_increment,
	primary key(nnet_produkt_varegruppe_id),
      nnet_produkt_varegruppe_navn varchar(255) not null 
	)TYPE=INNODB;

When you leave off the "TYPE" in your table definition, mySQL assumes it to
be "TYPE=MYISAM", which doesn't support foreign keys.

More on table types: http://www.mysql.com/doc/en/Table_types.html

Hope it helps :D

- Nasir

-----Original Message-----
From: Phil Powell [mailto:soazine at erols.com] 
Sent: Wednesday, September 10, 2003 2:58 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] can't create foreign key constraints in schema
-HELP!


You completely lost me. :(

Phil




More information about the talk mailing list