FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Migrate Class Reference
Inheritance diagram for Migrate:
Component Thing

Public Member Functions

 diff ()
 Difference between current database state and desired state based on migration files. More...
 
 execute ()
 Migrate the database. More...
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

const ACTION_EXEC = 'exec'
 New. More...
 
const ACTION_UNDO = 'undo'
 Removed. More...
 
const ACTION_REDO = 'redo'
 Changed. More...
 
const ACTION_TEST = 'test'
 Testing. More...
 
 $mask = '*.sql'
 Format for migration files. More...
 
 $path = null
 Directory with migration files (including trailing delimiter). More...
 
 $delimiter = '///// [action]'
 Delimiter for the migration file parts ([action] holds the action). More...
 
 $test = false
 Execute the 'test' part of the migration file. More...
 
- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 flatten ($sql)
 
 dir ($path)
 Return all migration files in a directory. More...
 
 split ($sql)
 
 getCurrent ()
 
 setCurrent ($value)
 
 getCurrentPath ()
 
- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_db = null
 
 $_currentPath = null
 Path with current files (keep out of version control; empty = path + "current/"). More...
 
 $_current = null
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Definition at line 5 of file Migrate.php.

Member Function Documentation

◆ diff()

diff ( )

Difference between current database state and desired state based on migration files.

Returns
array Key = migration filename, value = action.

Definition at line 41 of file Migrate.php.

◆ dir()

dir (   $path)
protected

Return all migration files in a directory.

Parameters
string$path
Returns
array Key = migration filename, value = SQL.

Definition at line 30 of file Migrate.php.

◆ execute()

execute ( )

Migrate the database.

Returns
array Key = migration filename, value = action.
See also
diff()

Definition at line 71 of file Migrate.php.

◆ flatten()

flatten (   $sql)
protected

Definition at line 22 of file Migrate.php.

◆ getCurrent()

getCurrent ( )
protected

Definition at line 102 of file Migrate.php.

◆ getCurrentPath()

getCurrentPath ( )
protected

Definition at line 112 of file Migrate.php.

◆ setCurrent()

setCurrent (   $value)
protected

Definition at line 107 of file Migrate.php.

◆ split()

split (   $sql)
protected

Definition at line 51 of file Migrate.php.

Field Documentation

◆ $_current

$_current = null
protected

Definition at line 20 of file Migrate.php.

◆ $_currentPath

$_currentPath = null
protected

Path with current files (keep out of version control; empty = path + "current/").

Definition at line 18 of file Migrate.php.

◆ $_db

$_db = null
protected

Definition at line 17 of file Migrate.php.

◆ $delimiter

$delimiter = '///// [action]'

Delimiter for the migration file parts ([action] holds the action).

Definition at line 14 of file Migrate.php.

◆ $mask

$mask = '*.sql'

Format for migration files.

Definition at line 12 of file Migrate.php.

◆ $path

$path = null

Directory with migration files (including trailing delimiter).

Definition at line 13 of file Migrate.php.

◆ $test

$test = false

Execute the 'test' part of the migration file.

Definition at line 15 of file Migrate.php.

◆ ACTION_EXEC

const ACTION_EXEC = 'exec'

New.

Definition at line 7 of file Migrate.php.

◆ ACTION_REDO

const ACTION_REDO = 'redo'

Changed.

Definition at line 9 of file Migrate.php.

◆ ACTION_TEST

const ACTION_TEST = 'test'

Testing.

Definition at line 10 of file Migrate.php.

◆ ACTION_UNDO

const ACTION_UNDO = 'undo'

Removed.

Definition at line 8 of file Migrate.php.


The documentation for this class was generated from the following file: