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;
    }
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;
    }
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 ; }
Sets up an tables and sequences for a Schema
@chainable
Sets up an tables and sequences for a Schema