summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/language/english/migration_lang.php6
-rw-r--r--system/libraries/Migration.php29
2 files changed, 18 insertions, 17 deletions
diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php
index 8e8b606c0..923f244f3 100644
--- a/system/language/english/migration_lang.php
+++ b/system/language/english/migration_lang.php
@@ -27,9 +27,9 @@
defined('BASEPATH') OR exit('No direct script access allowed');
$lang['migration_none_found'] = 'No migrations were found.';
-$lang['migration_not_found'] = 'No migration could be found with the version number: %d.';
-$lang['migration_sequence_gap'] = 'There is a gap in the migration sequence near version number: %d.';
-$lang['migration_multiple_version'] = 'There are multiple migrations with the same version number: %d.';
+$lang['migration_not_found'] = 'No migration could be found with the version number: %s.';
+$lang['migration_sequence_gap'] = 'There is a gap in the migration sequence near version number: %s.';
+$lang['migration_multiple_version'] = 'There are multiple migrations with the same version number: %s.';
$lang['migration_class_doesnt_exist'] = 'The migration class "%s" could not be found.';
$lang['migration_missing_up_method'] = 'The migration class "%s" is missing an "up" method.';
$lang['migration_missing_down_method'] = 'The migration class "%s" is missing a "down" method.';
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index 2ead3aec1..b226ee804 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -179,13 +179,14 @@ class CI_Migration {
* Calls each migration step required to get to the schema version of
* choice
*
- * @param int $target_version Target schema version
- * @return mixed TRUE if already latest, FALSE if failed, int if upgraded
+ * @param string $target_version Target schema version
+ * @return mixed TRUE if already latest, FALSE if failed, string if upgraded
*/
public function version($target_version)
{
- $current_version = (int) $this->_get_version();
- $target_version = (int) $target_version;
+ // Note: We use strings, so that timestamp versions work on 32-bit systems
+ $current_version = $this->_get_version();
+ $target_version = (string) $target_version;
$migrations = $this->find_migrations();
@@ -224,7 +225,7 @@ class CI_Migration {
return FALSE;
}
- include_once $file;
+ include_once($file);
$class = 'Migration_'.ucfirst(strtolower($this->_get_migration_name(basename($file, '.php'))));
// Validate the migration file structure
@@ -274,7 +275,7 @@ class CI_Migration {
/**
* Sets the schema to the latest migration
*
- * @return mixed TRUE if already latest, FALSE if failed, int if upgraded
+ * @return mixed TRUE if already latest, FALSE if failed, string if upgraded
*/
public function latest()
{
@@ -289,7 +290,7 @@ class CI_Migration {
$last_migration = basename(end($migrations));
// Calculate the last migration step from existing migration
- // filenames and procceed to the standard version migration
+ // filenames and proceed to the standard version migration
return $this->version($this->_get_migration_number($last_migration));
}
@@ -298,7 +299,7 @@ class CI_Migration {
/**
* Sets the schema to the migration version set in config
*
- * @return mixed TRUE if already current, FALSE if failed, int if upgraded
+ * @return mixed TRUE if already current, FALSE if failed, string if upgraded
*/
public function current()
{
@@ -359,12 +360,12 @@ class CI_Migration {
* Extracts the migration number from a filename
*
* @param string $migration
- * @return int Numeric portion of a migration filename
+ * @return string Numeric portion of a migration filename
*/
protected function _get_migration_number($migration)
{
- return sscanf($migration, '%d', $number)
- ? $number : 0;
+ return sscanf($migration, '%[0-9]+', $number)
+ ? $number : '0';
}
// --------------------------------------------------------------------
@@ -387,12 +388,12 @@ class CI_Migration {
/**
* Retrieves current schema version
*
- * @return int Current Migration
+ * @return string Current migration version
*/
protected function _get_version()
{
$row = $this->db->select('version')->get($this->_migration_table)->row();
- return $row ? $row->version : 0;
+ return $row ? $row->version : '0';
}
// --------------------------------------------------------------------
@@ -400,7 +401,7 @@ class CI_Migration {
/**
* Stores the current schema version
*
- * @param int $migration Migration reached
+ * @param string $migration Migration reached
* @return void Outputs a report of the migration
*/
protected function _update_version($migration)