[OpenSER-Devel] Defining MySQL foreign key constraint

Mircea Amarascu mircea at ag-projects.com
Wed Jul 11 13:26:57 CEST 2007


Hello,

I've written an OpenSER module that uses tables with the following 
structure:

CREATE TABLE `my_table` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `subscriber_id` int(10) unsigned default NULL,
  `data` varchar(32) default NULL,
  PRIMARY KEY  (`id`),
  KEY `my_table_subscriber_id_exists` (`subscriber_id`),
  CONSTRAINT `my_table_subscriber_id_exists` FOREIGN KEY 
(`subscriber_id`) REFERENCES `subscriber` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB

they link to the subscriber table using a foreign key constraint.

I'd like to ask how can I express this structure in DB schema's XML 
format, because I haven't found any example of something similar. Can 
you give me an answer, or point me to the appropriate documentation or 
references ?

Thank you.



More information about the Devel mailing list