Skip to content

Commit

Permalink
Changed the migration_style config setting to migration_type
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathon Hill <jhill@brandmovers.com>
  • Loading branch information
Jonathon Hill committed Nov 12, 2012
1 parent 3978fc3 commit b719bfd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions application/config/migration.php
Expand Up @@ -39,7 +39,7 @@


/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Migration Style | Migration Type
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Migration file names may be based on a sequential identifier or on | Migration file names may be based on a sequential identifier or on
Expand All @@ -53,7 +53,7 @@
| to 'sequential' for backward compatibility. | to 'sequential' for backward compatibility.
| |
*/ */
$config['migration_style'] = 'timestamp'; $config['migration_type'] = 'timestamp';


/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions system/libraries/Migration.php
Expand Up @@ -48,11 +48,11 @@ class CI_Migration {
protected $_migration_enabled = FALSE; protected $_migration_enabled = FALSE;


/** /**
* Migration numbering style * Migration numbering type
* *
* @var bool * @var bool
*/ */
protected $_migration_style = 'sequential'; protected $_migration_type = 'sequential';


/** /**
* Path to migration classes * Path to migration classes
Expand Down Expand Up @@ -142,12 +142,12 @@ public function __construct($config = array())
} }


// Migration basename regex // Migration basename regex
$this->_migration_regex = $this->_migration_style === 'timestamp' ? '/^\d{14}_(\w+)$/' : '/^\d{3}_(\w+)$/'; $this->_migration_regex = $this->_migration_type === 'timestamp' ? '/^\d{14}_(\w+)$/' : '/^\d{3}_(\w+)$/';


// Make sure a valid migration numbering style was set. // Make sure a valid migration numbering type was set.
if ( ! in_array($this->_migration_style, array('sequential', 'timestamp'))) if ( ! in_array($this->_migration_type, array('sequential', 'timestamp')))
{ {
show_error('An invalid migration numbering style was specified: '.$this->_migration_style); show_error('An invalid migration numbering type was specified: '.$this->_migration_type);
} }


// If the migrations table is missing, make it // If the migrations table is missing, make it
Expand Down Expand Up @@ -216,7 +216,7 @@ public function version($target_version)
foreach ($migrations as $number => $file) foreach ($migrations as $number => $file)
{ {
// Check for sequence gaps // Check for sequence gaps
if ($this->_migration_style === 'sequential' AND $previous !== FALSE AND abs($number - $previous) > 1) if ($this->_migration_type === 'sequential' AND $previous !== FALSE AND abs($number - $previous) > 1)
{ {
$this->_error_string = sprintf($this->lang->line('migration_sequence_gap'), $number); $this->_error_string = sprintf($this->lang->line('migration_sequence_gap'), $number);
return FALSE; return FALSE;
Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/source/libraries/migration.rst
Expand Up @@ -28,7 +28,7 @@ method taken. Two numbering styles are available:
helps prevent numbering conflicts when working in a team environment, and is helps prevent numbering conflicts when working in a team environment, and is
the preferred scheme in CodeIgniter 3.0 and later. the preferred scheme in CodeIgniter 3.0 and later.


The desired style may be selected using the **$config['migration_style']** The desired style may be selected using the **$config['migration_type']**
setting in your **migration.php** config file. setting in your **migration.php** config file.


Regardless of which numbering style you choose to use, prefix your migration Regardless of which numbering style you choose to use, prefix your migration
Expand Down Expand Up @@ -158,6 +158,6 @@ Preference Default Options Des
version number. version number.
**migration_auto_latest** FALSE TRUE / FALSE Enable or disable automatically **migration_auto_latest** FALSE TRUE / FALSE Enable or disable automatically
running migrations. running migrations.
**migration_style** 'timestamp' 'timestamp' / 'sequential' The type of numeric identifier used to name **migration_type** 'timestamp' 'timestamp' / 'sequential' The type of numeric identifier used to name
migration files. migration files.
========================== ====================== ========================== ============================================= ========================== ====================== ========================== =============================================

0 comments on commit b719bfd

Please sign in to comment.