src/Neutrino/Database/Schema/Blueprint.php
protected function runCommands(Db $db, DialectInterface $grammar)
    {
        $table = $this->table;
        $schema = $this->schema;

        foreach ($this->commands as $command) {
            switch ($command->get('name')) {
                case 'addColumn':
                    $db->addColumn(
                        $table,
                        $schema,
                        $this->fluentToColumn($command->get('column'), $grammar)
                    );
                    break;
                case 'renameColumn':
                    $columns = $db->describeColumns($table, $schema);
                    $from = null;
                    foreach ($columns as $column) {
                        if ($column->getName() === $command->get('from')) {
                            $from = $column;
                            break;
                        }
                    }
                    $definition = [
                        'type'          => $from->getType(),
                        'notNull'       => $from->isNotNull(),
                        'primary'       => $from->isPrimary(),
                        'autoIncrement' => $from->isAutoIncrement(),
                        'numeric'       => $from->isNumeric(),
                    ];

                    if (($typeReference = $from->getTypeReference()) !== -1) {
                        $definition['typeReference'] = $typeReference;
                    }
                    if (($typeValues = $from->getTypeValues()) !== -1) {
                        $definition['typeValues'] = $typeValues;
                    }
                    if (!empty($size = $from->getSize())) {
                        $definition['size'] = $size;
                    }
                    if (!is_null($default = $from->getDefault())) {
                        $definition['default'] = $default;
                    }
                    if (!empty($scale = $from->getScale())) {
                        $definition['scale'] = $scale;
                    }

                    $to = new Column($command->get('to'), $definition);

                    $db->modifyColumn($table, $schema, $to, $from);
                    break;
                case 'modifyColumn':
                    $db->modifyColumn(
                        $table,
                        $schema,
                        $this->fluentToColumn($command->get('column'), $grammar),
                        $command->get('from')
                    );
                    break;
                case 'addPrimary':
                    $db->addPrimaryKey(
                        $table,
                        $schema,
                        $this->fluentToIndex($command->get('index'), $grammar)
                    );
                    break;
                case 'addIndex':
                    $db->addIndex(
                        $table,
                        $schema,
                        $this->fluentToIndex($command->get('index'), $grammar)
                    );
                    break;
                case 'addForeign':
                    $db->addForeignKey(
                        $table,
                        $schema,
                        $this->fluentToReference($command->get('reference'))
                    );
                    break;
                case 'dropColumn':
                    $db->dropColumn(
                        $table,
                        $schema,
                        $command->get('column')
                    );
                    break;
                case 'dropForeign':
                    foreach ((array)$command->get('reference') as $reference) {
                        $db->dropForeignKey($table, $schema, $reference);
                    }
                    break;
                case 'dropIndex':
                    foreach ((array)$command->get('index') as $index) {
                        $db->dropIndex($table, $schema, $index);
                    }
                    break;
                case 'dropPrimary':
                    $db->dropPrimaryKey($table, $schema);
                    break;
                case 'rename':
                    $db->execute($grammar->renameTable($table, $command->get('to'), $schema));
                    break;
                case 'sql':
                    $db->execute($command->get('sql'));
                    break;
                default:
                    throw new UnknownCommandException($command);
            }
        }
    }
protected function runCommands(Db $db, DialectInterface $grammar)
    {
        $table = $this->table;
        $schema = $this->schema;

        foreach ($this->commands as $command) {
            switch ($command->get('name')) {
                case 'addColumn':
                    $db->addColumn(
                        $table,
                        $schema,
                        $this->fluentToColumn($command->get('column'), $grammar)
                    );
                    break;
                case 'renameColumn':
                    $columns = $db->describeColumns($table, $schema);
                    $from = null;
                    foreach ($columns as $column) {
                        if ($column->getName() === $command->get('from')) {
                            $from = $column;
                            break;
                        }
                    }
                    $definition = [
                        'type'          => $from->getType(),
                        'notNull'       => $from->isNotNull(),
                        'primary'       => $from->isPrimary(),
                        'autoIncrement' => $from->isAutoIncrement(),
                        'numeric'       => $from->isNumeric(),
                    ];

                    if (($typeReference = $from->getTypeReference()) !== -1) {
                        $definition['typeReference'] = $typeReference;
                    }
                    if (($typeValues = $from->getTypeValues()) !== -1) {
                        $definition['typeValues'] = $typeValues;
                    }
                    if (!empty($size = $from->getSize())) {
                        $definition['size'] = $size;
                    }
                    if (!is_null($default = $from->getDefault())) {
                        $definition['default'] = $default;
                    }
                    if (!empty($scale = $from->getScale())) {
                        $definition['scale'] = $scale;
                    }

                    $to = new Column($command->get('to'), $definition);

                    $db->modifyColumn($table, $schema, $to, $from);
                    break;
                case 'modifyColumn':
                    $db->modifyColumn(
                        $table,
                        $schema,
                        $this->fluentToColumn($command->get('column'), $grammar),
                        $command->get('from')
                    );
                    break;
                case 'addPrimary':
                    $db->addPrimaryKey(
                        $table,
                        $schema,
                        $this->fluentToIndex($command->get('index'), $grammar)
                    );
                    break;
                case 'addIndex':
                    $db->addIndex(
                        $table,
                        $schema,
                        $this->fluentToIndex($command->get('index'), $grammar)
                    );
                    break;
                case 'addForeign':
                    $db->addForeignKey(
                        $table,
                        $schema,
                        $this->fluentToReference($command->get('reference'))
                    );
                    break;
                case 'dropColumn':
                    $db->dropColumn(
                        $table,
                        $schema,
                        $command->get('column')
                    );
                    break;
                case 'dropForeign':
                    foreach ((array)$command->get('reference') as $reference) {
                        $db->dropForeignKey($table, $schema, $reference);
                    }
                    break;
                case 'dropIndex':
                    foreach ((array)$command->get('index') as $index) {
                        $db->dropIndex($table, $schema, $index);
                    }
                    break;
                case 'dropPrimary':
                    $db->dropPrimaryKey($table, $schema);
                    break;
                case 'rename':
                    $db->execute($grammar->renameTable($table, $command->get('to'), $schema));
                    break;
                case 'sql':
                    $db->execute($command->get('sql'));
                    break;
                default:
                    throw new UnknownCommandException($command);
            }
        }
    }
@param \Phalcon\Db\AdapterInterface               $db
@param \Neutrino\Database\Schema\DialectInterface $grammar

@throws \Neutrino\Database\Schema\Exception\CommandException
@throws \Neutrino\Database\Schema\Exception\UnknownCommandException