. * * Script de migration de la base */ if (!defined('BASEPATH')) exit ('No direct script access allowed'); /** * Passe les compteurs de tickets en décimal * * @author frederic * */ class Migration_Licence_Federale extends CI_Migration { protected $number; /** * * Constructor * * Affiche header et menu */ function __construct() { parent :: __construct(); $this->number = 16; } /* * Execute an array of sql requests */ private function run_queries($sqls = array()) { $errors = 0; foreach ($sqls as $sql) { // echo $sql . br(); if (!$this->db->query($sql)) {$errors += 1;} } return $errors; } /** * Apply the migration */ public function up() { $errors = 0; $sqls = array( "ALTER TABLE `membres` ADD `licfed` INT NULL COMMENT 'Numéro de licence fédérale' ;" ); $errors += $this->run_queries($sqls); gvv_info("Migration database up to " . $this->number . ", errors=$errors"); return !$errors; } /** * Reverse the migration */ public function down() { $errors = 0; $sqls = array( "ALTER TABLE `membres` DROP `licfed`;" ); $errors += $this->run_queries($sqls); gvv_info("Migration database down to " . $this->number - 1 . ", errors=$errors"); return !$errors; } }