ALTER TABLE `$table` CHANGE `id` `id` INT( 11 ) NOT NULL; 
ALTER TABLE `$table` DROP PRIMARY KEY ;
ALTER TABLE `$table` ADD `version_id` INT NOT NULL AUTO_INCREMENT ,
ADD `version_created` DATETIME NOT NULL ,
ADD PRIMARY KEY ( `version_id` ) ;
ALTER TABLE `$table` DROP PRIMARY KEY ,
ADD PRIMARY KEY ( `version_id` ) 
#echo phpinfo();
if($_GET['table']) {
$table=$_GET['table']."_revs";
 
echo "Table: " .$table;
 
echo "<pre>
ALTER TABLE `" .$table ."` CHANGE `id` `id` INT( 11 ) NOT NULL; 
ALTER TABLE `" .$table ."` DROP PRIMARY KEY ;
ALTER TABLE `" .$table ."` ADD `version_id` INT NOT NULL AUTO_INCREMENT ,
ADD `version_created` DATETIME NOT NULL ,
ADD PRIMARY KEY ( `version_id` ) ;
ALTER TABLE `" .$table ."` DROP PRIMARY KEY ,
ADD PRIMARY KEY ( `version_id` ) 
</pre>";
 
} else {
echo '
<form>
Renseignez le nom de votre table <input tape="text" name="table">
<input type="submit">
</form>
';
}
  • info/cakephpversioning.txt
  • Dernière modification: 2018/07/18 09:45
  • par radeff