Beispiel #1
0
 /**
  * Apply database patches
  */
 public function action_patches()
 {
     Sink::instance()->patch($available, $applied);
     echo '<h1>Patches:</h1>';
     echo '<h2>Available patches:</h2>';
     echo '<pre>';
     foreach ($available as $table => $patches) {
         foreach ($patches as $num => $descrip) {
             echo "{$num} [{$table}] - {$descrip}<br />";
         }
     }
     echo '</pre>';
     echo '<h2>Applied patches:</h2>';
     echo '<pre>';
     foreach ($applied as $table => $patches) {
         foreach ($patches as $num => $patch) {
             echo "{$num} [{$table}] - {$patch['descrip']}<br />";
             echo '  ' . ($patch['result'] ? 'Patch applied successfully.' : 'Error applying patch.') . '<br />';
         }
     }
     echo '</pre>';
 }
Beispiel #2
0
 /**
  * Test patching on a previous patch
  */
 public function testSecondPatch()
 {
     $sink = new Sink();
     $sink->table('ut_pop');
     $sink->initialize();
     DB::insert('db_deltas', array('id', 'file'))->values(array(1, '01-ut_pop-add_column'))->execute();
     $sink->patch($available, $applied);
     $this->assertArrayHasKey('ut_pop', $applied);
     $this->assertEquals(1, count($applied['ut_pop']));
     $this->assertTrue($applied['ut_pop'][2]['result']);
     $database = Database::instance();
     $columns = $database->list_columns('ut_pop');
     $this->assertArrayNotHasKey('editor', $columns);
     $this->assertArrayHasKey('modified', $columns);
 }
Beispiel #3
0
 public function before()
 {
     Sink::instance()->tables(array('ut_init', 'ut_pop'));
 }
Beispiel #4
0
 /**
  * Set tables
  */
 public function before()
 {
     Sink::instance()->table('users');
 }