public function createSchema($source, $schema) {
		if (!$schema instanceof $this->_classes['schema']) {
			throw new InvalidArgumentException("Passed schema is not a valid `{$class}` instance.");
		}

		$columns = [];
		$primary = null;

		$source = $this->name($source);

		foreach ($schema->fields() as $name => $field) {
			$field['name'] = $name;
			if ($field['type'] === 'id') {
				$primary = $name;
			}
			$columns[] = $this->column($field);
		}
		$columns = join(",\n", array_filter($columns));

		$metas = $schema->meta() + ['table' => [], 'constraints' => []];

		$constraints = $this->_buildConstraints($metas['constraints'], $schema, ",\n", $primary);
		$table = $this->_buildMetas('table', $metas['table']);

		$params = compact('source', 'columns', 'constraints', 'table');
		return $this->_execute($this->renderCommand('schema', $params));
	}
public function createSchema($source, $schema) {
		if (!$schema instanceof $this->_classes['schema']) {
			throw new InvalidArgumentException("Passed schema is not a valid `{$class}` instance.");
		}

		$columns = [];
		$primary = null;

		$source = $this->name($source);

		foreach ($schema->fields() as $name => $field) {
			$field['name'] = $name;
			if ($field['type'] === 'id') {
				$primary = $name;
			}
			$columns[] = $this->column($field);
		}
		$columns = join(",\n", array_filter($columns));

		$metas = $schema->meta() + ['table' => [], 'constraints' => []];

		$constraints = $this->_buildConstraints($metas['constraints'], $schema, ",\n", $primary);
		$table = $this->_buildMetas('table', $metas['table']);

		$params = compact('source', 'columns', 'constraints', 'table');
		return $this->_execute($this->renderCommand('schema', $params));
	}
public function createSchema ( $ source , $ schema ) { if ( ! $ schema instanceof $ this -> _classes [ 'schema' ] ) { throw new InvalidArgumentException ( "Passed schema is not a valid `{$class}` instance." ) ; } $ columns = [ ] ; $ primary = null ; $ source = $ this -> name ( $ source ) ; foreach ( $ schema -> fields ( ) as $ name => $ field ) { $ field [ 'name' ] = $ name ; if ( $ field [ 'type' ] === 'id' ) { $ primary = $ name ; } $ columns [ ] = $ this -> column ( $ field ) ; } $ columns = join ( ",\n" , array_filter ( $ columns ) ) ; $ metas = $ schema -> meta ( ) + [ 'table' => [ ] , 'constraints' => [ ] ] ; $ constraints = $ this -> _buildConstraints ( $ metas [ 'constraints' ] , $ schema , ",\n" , $ primary ) ; $ table = $ this -> _buildMetas ( 'table' , $ metas [ 'table' ] ) ; $ params = compact ( 'source' , 'columns' , 'constraints' , 'table' ) ; return $ this -> _execute ( $ this -> renderCommand ( 'schema' , $ params ) ) ; }
Create a database-native schema

@param string $source A table name.
@param object $schema A `Schema` instance.
@return boolean `true` on success, `true` otherwise
Create a database - native schema