Get the primary key syntax for a table creation statement.

@param  \Nova\Database\Schema\Blueprint  $blueprint
@return string|null
503867
protected function addPrimaryKeys(Blueprint $blueprint)
    {
        $primary = $this->getCommandByName($blueprint, 'primary');

        if (! is_null($primary)) {
            $columns = $this->columnize($primary->columns);

            return ", primary key ({$columns})";
        }
    }
714156
protected function modifyComment(Blueprint $blueprint, Fluent $column)
    {
        if (! is_null($column->comment)) {
            return " comment '".addslashes($column->comment)."'";
        }
    }
100835
public function PrimaryKey($Table, $Database = NULL) {
      $Schema = $this->Fetch($Table, $Database);
      $PrimaryKeys = array();
      foreach ($Schema as $FieldName => $Properties) {
         if ($Properties->PrimaryKey === TRUE)
            $PrimaryKeys[] = $FieldName;
      }
      
      if (count($PrimaryKeys) == 0)
         return '';
      elseif (count($PrimaryKeys) == 1)
         return $PrimaryKeys[0];
      else
         return $PrimaryKeys;
   }
630735
protected function getScript($key)
    {
        if (!isset($this->blueprintConfig[$key])) {
            return null;
        }
        $script = is_array($this->blueprintConfig[$key]) ? implode("\n", $this->blueprintConfig[$key]) : $this->blueprintConfig[$key];

        return $this->valueResolver->resolvePlaceholders($script, $this, 'script');
    }
742584
public function compileCreate(BaseBlueprint $blueprint, Fluent $command)
    {
        $sql = parent::compileCreate($blueprint, $command);

        if (isset($blueprint->inherits)) {
            $sql .= ' INHERITS ("'.$blueprint->inherits.'")';
        }
        return $sql;
    }
617386
protected function build(Blueprint $blueprint) {
        $grammar = new \Sgpatil\Orientdb\Schema\Grammars\OrientdbGrammar();
        $blueprint->build($this->connection, $grammar);
    }
184850
public function create($blueprint)
    {
        $name = $blueprint->name;
        $type = $blueprint->type;
        if (!isset($this->count[$name])) {
            $this->count[$name] = 0;
        }

        $count = ++$this->count[$name];

        $values = $blueprint->values();

        $strings = array_map(function ($value) use ($count) {
            return str_replace('#{sn}', str_pad($count, 4, '0', STR_PAD_LEFT), $value);
        }, $blueprint->strings());

        $relationships = $blueprint->relationships();

        foreach ($relationships as $key => $relationship) {
            $relationships[$key] = $relationship->create($blueprint->persisted);
        }

        $values = array_merge($values, $strings, $relationships);

        $dependencies = array_map(function ($value) use ($values) {
            return $value->meet($values);
        }, $blueprint->dependencies());

        $values = array_merge($values, $dependencies);

        //$object = $this->toObject($name, $values);
        $object = $this->to_object($name, $values); // @deprecated Backwards compatibility

        if (false == $blueprint->persisted) {
            return $object;
        }

        \Phactory::triggers()->beforeSave($name, $type, $object);

        //$object = $this->saveObject($name, $object);
        $object = $this->save_object($name, $object); // @deprecated Backwards compatibility

        \Phactory::triggers()->afterSave($name, $type, $object);

        return $object;
    }
280380
protected static function getTableWithColumnChanges(Blueprint $blueprint, Table $table)
    {
        $table = clone $table;

        foreach ($blueprint->getChangedColumns() as $fluent) {
            $column = static::getDoctrineColumn($table, $fluent);

            // Here we will spin through each fluent column definition and map it to the proper
            // Doctrine column definitions - which is necessary because Laravel and Doctrine
            // use some different terminology for various column attributes on the tables.
            foreach ($fluent->getAttributes() as $key => $value) {
                if (! is_null($option = static::mapFluentOptionToDoctrine($key))) {
                    if (method_exists($column, $method = 'set'.ucfirst($option))) {
                        $column->{$method}(static::mapFluentValueToDoctrine($option, $value));
                    }
                }
            }
        }

        return $table;
    }
911095
private function commentColumns(OracleBlueprint $blueprint)
    {
        foreach ($blueprint->commentColumns as $column => $comment) {
            $this->commentColumn($blueprint->getTable(), $column, $comment);
        }
    }
202897
protected function modifyAfter(Blueprint $blueprint, Fluent $column)
    {
        if (! is_null($column->after)) {
            return ' after '.$this->wrap($column->after);
        }
    }
655074
protected function getTable(array $blueprints) {
        $results = [];

        foreach($blueprints as $key => $blueprint) {
            $results[] = $this->getGeneralInformation($key, $blueprint);
        }

        return array_filter($results);
    }
265024
public function compileDropColumn(Blueprint $blueprint, Fluent $command, Connection $connection)
    {
        $tableDiff = $this->getDoctrineTableDiff(
            $blueprint, $schema = $connection->getDoctrineSchemaManager()
        );

        foreach ($command->columns as $name) {
            $tableDiff->removedColumns[$name] = $connection->getDoctrineColumn(
                $this->getTablePrefix().$blueprint->getTable(), $name
            );
        }

        return (array) $schema->getDatabasePlatform()->getAlterTableSQL($tableDiff);
    }
372256
public function createAutoIncrementObjects(Blueprint $blueprint, $table)
    {
        $column = $this->getQualifiedAutoIncrementColumn($blueprint);

        // return if no qualified AI column
        if (is_null($column)) {
            return;
        }

        $col   = $column->name;
        $start = isset($column->start) ? $column->start : 1;

        // get table prefix
        $prefix = $this->connection->getTablePrefix();

        // create sequence for auto increment
        $sequenceName = $this->createObjectName($prefix, $table, $col, 'seq');
        $this->sequence->create($sequenceName, $start, $column->nocache);

        // create trigger for auto increment work around
        $triggerName = $this->createObjectName($prefix, $table, $col, 'trg');
        $this->trigger->autoIncrement($prefix . $table, $col, $triggerName, $sequenceName);
    }
509976
public function compileDropIfExists(Blueprint $blueprint, Fluent $command)
    {
        return sprintf('if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = %s) drop table %s',
            "'".str_replace("'", "''", $this->getTablePrefix().$blueprint->getTable())."'",
            $this->wrapTable($blueprint)
        );
    }
322363
public function compileRenameIndex(Blueprint $blueprint, Fluent $command)
    {
        return sprintf('alter index %s rename to %s',
            $this->wrap($command->from),
            $this->wrap($command->to)
        );
    }
285131
protected function compileCreateEngine($sql, Connection $connection, Blueprint $blueprint)
    {
        if (isset($blueprint->engine)) {
            return $sql.' engine = '.$blueprint->engine;
        } elseif (! is_null($engine = $connection->getConfig('engine'))) {
            return $sql.' engine = '.$engine;
        }

        return $sql;
    }
822369
public function getPrimaryKey($tableName) {
	
		// check whether table exists
	
		if(!$this->tableExists($tableName)) {
			throw new \PDOException(sprintf("Unknown table '%s'.", $tableName));
		}
	
		// get pk information
	
		if(empty($this->tableStructureCache[$tableName])) {
			$this->fillTableStructureCache($tableName);
		}
	
		$pkLength = count($this->tableStructureCache[$tableName]['_primaryKeyColumns']);
	
		switch ($pkLength) {
			case 0:
				return null;
	
			case 1:
				return $this->tableStructureCache[$tableName]['_primaryKeyColumns'][0];
	
			default:
				return $this->tableStructureCache[$tableName]['_primaryKeyColumns'];
		}
	
	}