Compile a rename column command.

@param  \Illuminate\Database\Schema\Blueprint $blueprint
@param  \Illuminate\Support\Fluent $command
@param  \Illuminate\Database\Connection $connection
@return array
18781
public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
    {
        $table = $this->wrapTable($blueprint);

        $rs    = [];
        $rs[0] = 'alter table ' . $table . ' rename column ' . $command->from . ' to ' . $command->to;

        return (array) $rs;
    }
1047517
private function readMigrated(Connection $connection): array
    {
        $builder  = $connection->createQueryBuilder();
        $migrated = [];

        if ($connection->getSchemaManager()->tablesExist([static::MIGRATIONS_TABLE]) === true) {
            $migrations = $builder
                ->select(static::MIGRATIONS_COLUMN_ID, static::MIGRATIONS_COLUMN_CLASS)
                ->from(static::MIGRATIONS_TABLE)
                ->orderBy(static::MIGRATIONS_COLUMN_ID)
                ->execute()
                ->fetchAll();
            foreach ($migrations as $migration) {
                $index            = $migration[static::MIGRATIONS_COLUMN_ID];
                $class            = $migration[static::MIGRATIONS_COLUMN_CLASS];
                $migrated[$index] = $class;
            }
        }

        return $migrated;
    }
990440
public function compileChange( Blueprint $blueprint, Fluent $command, Connection $connection )
	{
		if ( !$connection->isDoctrineAvailable() )
		{
			throw new RuntimeException( sprintf( 'Changing columns for table "%s" requires Doctrine DBAL; install "doctrine/dbal".', $blueprint->getTable() ) );
		}

		$schema = $connection->getDoctrineSchemaManager();

		$tableDiff = $this->getChangedDiff( $blueprint, $schema );

		if ( $tableDiff !== false )
		{
			return (array) $schema->getDatabasePlatform()->getAlterTableSQL( $tableDiff );
		}

		return [];
	}
911095
private function commentColumns(OracleBlueprint $blueprint)
    {
        foreach ($blueprint->commentColumns as $column => $comment) {
            $this->commentColumn($blueprint->getTable(), $column, $comment);
        }
    }
484791
protected static function getSchemaBuilder(Connection $connection)
    {
        $schemaBuilder = $connection->getSchemaBuilder();
        $schemaBuilder->blueprintResolver(function ($table, $callback) {
            return new Blueprint($table, $callback);
        });

        return $schemaBuilder;
    }
1124326
public function compilePrimary(Blueprint $blueprint, Fluent $command)
    {
        $columns = $this->columnize($command->columns);

        return 'alter table '.$this->wrapTable($blueprint)." add primary key ({$columns})";
    }
195440
protected static function paths(Blueprint $blueprint, $directory, $filename = null)
    {
        $yaml = file_exists($filename) ? file_get_contents($filename) : '';

        $yaml = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $yaml);

        $yaml = str_replace('%%CURRENT_DIRECTORY%%', $directory, $yaml);

        $result = Yaml::parse($yaml) ?: self::defaults();

        $blueprint->setTemplatePath($result['paths']['templates']);

        $blueprint->setCommandPath($result['paths']['commands']);

        $blueprint->setCommandNamespace($result['namespaces']['commands']);

        return $blueprint;
    }
1099505
public function compileRename(Blueprint $blueprint, Fluent $command)
    {
        $from = $this->wrapTable($blueprint);

        return "alter table {$from} rename to ".$this->wrapTable($command->to);
    }
368309
public function blueprint(Blueprint $blueprint) {
        foreach($blueprint->getActions() as $action) {
            $this->action($action);
        }
    }
634883
protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column)
    {
        $tableDiff->renamedColumns = [
            $command->from => new Column($command->to, $column->getType(), $column->toArray()),
        ];

        return $tableDiff;
    }
255950
protected function compileKey( Blueprint $blueprint, Fluent $command, $type )
	{
		$columns = $this->columnize( $command->columns );

		$table = $this->wrapTable( $blueprint );

		$index = $this->wrap( $command->index );

		return "alter table {$table} add {$type} {$index}($columns)";
	}
10477
protected function compileGeometry(Blueprint $blueprint, Fluent $command)
    {

        $dimensions = $command->dimensions ?: 2;
        $typmod = $command->typmod ? 'true' : 'false';
        $srid = $command->srid ?: 4326;

        return sprintf(
            "SELECT AddGeometryColumn('%s', '%s', %d, '%s', %d, %s)",
            $blueprint->getTable(),
            $command->column,
            $srid,
            strtoupper($command->type),
            $dimensions,
            $typmod
        );
    }
545436
protected function makeCommand($connection, $connectionName)
    {
        $cmd[] = 'mysqldump -u ' . $connection['username'];
        $cmd[] = '--password=' . $connection['password'];
        $cmd[] = $connection['database'];
        $cmd[] = ' -h ' . $connection['host'];
        if ( ! empty($connection['port'])) {
            $cmd[] = '-P ' . $connection['port'];
        }
        $cmd[] = '> ' . $this->filename($connectionName);
        return implode(' ', $cmd);
    }
82558
public function compileCreate(Blueprint $blueprint, Fluent $command, Connection $connection)
    {
        $sql = parent::compileCreate($blueprint, $command, $connection);
        // 添加注释
        if (isset($blueprint->comment))
        {
            $blueprint->comment = str_replace("'", "\'", $blueprint->comment);
            $sql .= " comment = '".$blueprint->comment."'";
        }
        // 添加自增起始值
        if (isset($blueprint->autoIncrement)) {
            $blueprint->autoIncrement = intval($blueprint->autoIncrement);
            $sql .= " auto_increment = {$blueprint->autoIncrement}";
        }
        return $sql;
    }
76244
public function build(Connection $connection, Grammar $grammar)
    {
        $command = $this->parseCommand($this->commands[0]->get('name'));
        $schema  = $connection->getSchemaBuilder();

        if ($command === "drop") {
            $schema->dropIfExists($this->getI18NTableName());
        }

        parent::build($connection, $grammar);

        if ($command === "create") {
            $primary      = $this->i18n_primary;
            $i18n_columns = $this->i18n_columns;
            $table_name   = $this->table;
            $schema->create($this->getI18NTableName(), function (Blueprint $table) use ($table_name, $primary, $i18n_columns) {
                foreach ($primary as $name => $col) {
                    $table->columns[] = $col;

                    $table->foreign($col->get('name'))->references($col->get('name'))->on($table_name)->onDelete('cascade');
                }

                foreach ($i18n_columns as $col) {
                    $table->columns[] = $col;
                }

                $table->string($this->i18n_code_field, 10);
                $table->primary(array_merge(array_keys($primary), [$this->i18n_code_field]));
            });
        }
    }
527853
public function compileForeign(Blueprint $blueprint, Fluent $command)
    {
        // We need to prepare several of the elements of the foreign key definition
        // before we can create the SQL, such as wrapping the tables and convert
        // an array of columns to comma-delimited strings for the SQL queries.
        $sql = sprintf('alter table %s add constraint %s ',
            $this->wrapTable($blueprint),
            $this->wrap($command->index)
        );

        // Once we have the initial portion of the SQL statement we will add on the
        // key name, table name, and referenced columns. These will complete the
        // main portion of the SQL statement and this SQL will almost be done.
        $sql .= sprintf('foreign key (%s) references %s (%s)',
            $this->columnize($command->columns),
            $this->wrapTable($command->on),
            $this->columnize((array) $command->references)
        );

        // Once we have the basic foreign key creation statement constructed we can
        // build out the syntax for what should happen on an update or delete of
        // the affected columns, which will get something like "cascade", etc.
        if (! is_null($command->onDelete)) {
            $sql .= " on delete {$command->onDelete}";
        }

        if (! is_null($command->onUpdate)) {
            $sql .= " on update {$command->onUpdate}";
        }

        return $sql;
    }
617386
protected function build(Blueprint $blueprint) {
        $grammar = new \Sgpatil\Orientdb\Schema\Grammars\OrientdbGrammar();
        $blueprint->build($this->connection, $grammar);
    }