mirror of
https://github.com/Oreolek/kohana-migrations.git
synced 2024-06-16 23:11:06 +03:00
Improving the output of db:migrate to show number of migrations run & also status of locations
This commit is contained in:
parent
7ff67837b6
commit
d463d9f873
|
@ -106,6 +106,15 @@ class Minion_Migration_Manager {
|
||||||
return $this->_dry_run_sql;
|
return $this->_dry_run_sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a set of executed migrations
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_executed_migrations()
|
||||||
|
{
|
||||||
|
return $this->_executed_migrations;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run migrations in the specified locations so as to reach specified targets
|
* Run migrations in the specified locations so as to reach specified targets
|
||||||
*
|
*
|
||||||
|
@ -194,6 +203,8 @@ class Minion_Migration_Manager {
|
||||||
{
|
{
|
||||||
$this->_model->mark_migration($migration, $location['direction']);
|
$this->_model->mark_migration($migration, $location['direction']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->_executed_migrations[] = $migration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,9 @@ class Minion_Task_Db_Migrate extends Minion_Task
|
||||||
$view = View::factory('minion/task/db/migrate')
|
$view = View::factory('minion/task/db/migrate')
|
||||||
->set('dry_run', $dry_run)
|
->set('dry_run', $dry_run)
|
||||||
->set('quiet', $quiet)
|
->set('quiet', $quiet)
|
||||||
->set('dry_run_sql', $manager->get_dry_run_sql());
|
->set('dry_run_sql', $manager->get_dry_run_sql())
|
||||||
|
->set('executed_migrations', $manager->get_executed_migrations())
|
||||||
|
->set('location_versions', $model->fetch_current_versions());
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
|
<? if( ! $quiet): ?>
|
||||||
|
Executed <?php echo count($executed_migrations); ?> migrations
|
||||||
|
|
||||||
|
Current versions of locations:
|
||||||
|
<?php foreach($location_versions as $location): ?>
|
||||||
|
* <?php echo $location['location'] ?> : <?php echo $location['timestamp'] ?> (<?php echo $location['description']; ?>)
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<?php if($dry_run): ?>
|
<?php if($dry_run): ?>
|
||||||
<?php if( ! $quiet): ?>
|
This was a dry run, if it was a real run the following SQL would've been executed:
|
||||||
|
<?php endif; ?>
|
||||||
This was a dry run, SQL is as follows:
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php foreach($dry_run_sql as $location => $migrations): ?>
|
<?php foreach($dry_run_sql as $location => $migrations): ?>
|
||||||
|
|
||||||
<?php $location_padding = str_repeat('#', strlen($location)); ?>
|
<?php $location_padding = str_repeat('#', strlen($location)); ?>
|
||||||
##################<?php echo $location_padding ?>##
|
##################<?php echo $location_padding ?>##
|
||||||
# Begin Location: <?php echo $location; ?> #
|
# Begin Location: <?php echo $location; ?> #
|
||||||
|
@ -27,5 +34,3 @@ This was a dry run, SQL is as follows:
|
||||||
################<?php echo $location_padding ?>##
|
################<?php echo $location_padding ?>##
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue