Pheasant\Migrate\Migrator::initialize PHP Method

initialize() public method

Sets up an tables and sequences for a Schema
public initialize ( $schema, $table = null )
    public function initialize($schema, $table = null)
    {
        $mapper = $this->_mapper($schema);
        $table = $table ? $this->_connection($schema)->table($table) : $mapper->table();
        $sequencePool = $this->_connection($schema)->sequencePool();
        $sequencePool->initialize();
        $columns = array();
        // build a map of properties to create
        foreach ($schema->properties() as $prop) {
            $columns[$prop->name] = $prop->type;
            // reset sequences as we go
            if (property_exists($prop->type, 'sequence')) {
                $sequencePool->delete($mapper->sequenceName($prop));
            }
        }
        $table->create($columns);
        return $this;
    }