
CREATE TABLE cd (
  id int(11) NOT NULL auto_increment,
  title varchar(255) NOT NULL default 'Untitled',
  PRIMARY KEY (id)
) Type=InnoDB;

CREATE TABLE song (
  id int(11) NOT NULL auto_increment,
  name varchar(255) NOT NULL default 'blank',
  PRIMARY KEY (id)
) Type=InnoDB;

CREATE TABLE track (
  id int(11) NOT NULL auto_increment,
  seqnum int(11) NOT NULL default '-1',	
  song int(11) NOT NULL default '0',
  cd int(11) NOT NULL default '0',
  PRIMARY KEY (id),
  INDEX (song),
  FOREIGN KEY (song) REFERENCES song(id) ON DELETE CASCADE,
  INDEX (cd),
  FOREIGN KEY (cd) REFERENCES cd(id) ON DELETE CASCADE
) Type=InnoDB;
