Get the SQL for a nullable column modifier.

@param  \Illuminate\Database\Schema\Blueprint $blueprint
@param  \Illuminate\Support\Fluent $column
@return string
504838
protected function modifyNullable(Blueprint $blueprint, Fluent $column)
    {
        // check if field is declared as enum
        $enum = '';
        if (count((array) $column->allowed)) {
            $columnName = $this->wrapValue($column->name);
            $enum       = " check ({$columnName} in ('" . implode("', '", $column->allowed) . "'))";
        }

        $null = $column->nullable ? ' null' : ' not null';
        $null .= $enum;

        if (! is_null($column->default)) {
            return ' default ' . $this->getDefaultValue($column->default) . $null;
        }

        return $null;
    }
1170471
protected function modifyDefault(Blueprint $blueprint, Fluent $column)
    {
        if (! is_null($column->default)) {
            return ' default '.$this->getDefaultValue($column->default);
        }
    }
651762
def _add_modifiers(self, sql, blueprint, column):
        
        for modifier in self._modifiers:
            method = '_modify_%s' % modifier

            if hasattr(self, method):
                sql += getattr(self, method)(blueprint, column)

        return sql
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 [];
	}
368309
public function blueprint(Blueprint $blueprint) {
        foreach($blueprint->getActions() as $action) {
            $this->action($action);
        }
    }
1229122
public function compileAdd(Blueprint $blueprint, Fluent $command)
    {
        $columns = $this->prefixArray('add column', $this->getColumns($blueprint));

        return collect($columns)->map(function ($column) use ($blueprint) {
            return 'alter table '.$this->wrapTable($blueprint).' '.$column;
        })->all();
    }
72264
public function compileAdd(Blueprint $blueprint, Fluent $command)
	{
		$table = $this->wrapTable($blueprint);

		$columns = $this->prefixArray('add column', $this->getColumns($blueprint));

		foreach ($columns as $column)
		{
			$statements[] = 'alter table '.$table.' '.$column;
		}

		return $statements;
	}
482781
public function compileForeign(Blueprint $blueprint, Fluent $command)
    {
        $sql = parent::compileForeign($blueprint, $command);

        if (! is_null($command->deferrable)) {
            $sql .= $command->deferrable ? ' deferrable' : ' not deferrable';
        }

        if ($command->deferrable && ! is_null($command->initiallyImmediate)) {
            $sql .= $command->initiallyImmediate ? ' initially immediate' : ' initially deferred';
        }

        if (! is_null($command->notValid)) {
            $sql .= ' not valid';
        }

        return $sql;
    }
288795
protected function addForeignKeys(Blueprint $blueprint)
    {
        $sql = '';

        $foreigns = $this->getCommandsByName($blueprint, 'foreign');

        // Once we have all the foreign key commands for the table creation statement
        // we'll loop through each of them and add them to the create table SQL we
        // are building
        foreach ($foreigns as $foreign) {
            $on = $this->wrapTable($foreign->on);

            $columns = $this->columnize($foreign->columns);

            $onColumns = $this->columnize((array) $foreign->references);

            $sql .= ", constraint {$foreign->index} foreign key ( {$columns} ) references {$on} ( {$onColumns} )";

            // 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($foreign->onDelete)) {
                $sql .= " on delete {$foreign->onDelete}";
            }
        }

        return $sql;
    }
246458
protected function build(Blueprint $blueprint)
    {
        return $blueprint->build(
            $this->getConnection(),
            $this->conn->getSchemaGrammar()
        );
    }
1099505
public function compileRename(Blueprint $blueprint, Fluent $command)
    {
        $from = $this->wrapTable($blueprint);

        return "alter table {$from} rename to ".$this->wrapTable($command->to);
    }
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;
    }
200826
public function compileDropPrimary(Blueprint $blueprint, Fluent $command)
    {
        $index = $this->wrap($command->index);

        return "alter table {$this->wrapTable($blueprint)} drop constraint {$index}";
    }
1156292
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        $columns = implode(', ', $this->getColumns($blueprint));

        $sql = 'create table '.$this->wrapTable($blueprint)." ($columns";

        // SQLite forces primary keys to be added when the table is initially created
        // so we will need to check for a primary key commands and add the columns
        // to the table's declaration here so they can be created on the tables.
        $sql .= (string) $this->addForeignKeys($blueprint);

        $sql .= (string) $this->addPrimaryKeys($blueprint);

        return $sql .= ')';
    }
196370
protected function _getBlobColumn(Column\Blob $column)
    {
        return sprintf(
            '%s BLOB%s%s',
            $column->getName(),
            $this->_columnLength($column),
            $this->_nullableColumn($column)
        );
    }
546908
public function compileCreate(Blueprint $blueprint, Fluent $command)
    {
        $fields = $blueprint->getFields();

        $statement = $this->compileFields($fields);

        return $statement;
    }
341321
protected function getChangedDiff( Blueprint $blueprint, SchemaManager $schema )
	{
		$table = $schema->listTableDetails( $this->getTablePrefix() . $blueprint->getTable() );

		return ( new Comparator )->diffTable( $table, $this->getTableWithColumnChanges( $blueprint, $table ) );
	}