2 if ($version == 1) { mysql_query("BEGIN TRANSACTION"); mysql_query(" CREATE TABLE IF NOT EXISTS periodes ( id mediumint(3) unsigned NOT NULL auto_increment, nom varchar(200) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED; "); mysql_query("INSERT INTO periodes (nom) VALUES ('Vendredi soir à samedi')"); mysql_query("INSERT INTO periodes (nom) VALUES ('Samedi à dimanche')"); mysql_query("INSERT INTO periodes (nom) VALUES ('Dimanche à lundi')"); mysql_query(" CREATE TABLE IF NOT EXISTS participations ( participant_id mediumint(3) unsigned NOT NULL, periode_id mediumint(3) unsigned NOT NULL, PRIMARY KEY USING BTREE (participant_id, periode_id), KEY FK_periode (periode_id), CONSTRAINT FK_participant_participations FOREIGN KEY (participant_id) REFERENCES participants (id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT FK_periode_participations FOREIGN KEY (periode_id) REFERENCES periodes (id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; "); mysql_query("UPDATE config SET valeur = '2' WHERE nom = 'version')"); mysql_query("COMMIT"); } } update_db(); ?>