framework/db/CDbMigration.php
public function addPrimaryKey($name,$table,$columns)
	{
		echo "    > alter table $table add constraint $name primary key (".(is_array($columns) ? implode(',', $columns) : $columns).") ...";
		$time=microtime(true);
		$this->getDbConnection()->createCommand()->addPrimaryKey($name,$table,$columns);
		echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
	}
public function addPrimaryKey($name,$table,$columns)
	{
		echo "    > alter table $table add constraint $name primary key (".(is_array($columns) ? implode(',', $columns) : $columns).") ...";
		$time=microtime(true);
		$this->getDbConnection()->createCommand()->addPrimaryKey($name,$table,$columns);
		echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
	}
public function addPrimaryKey ( $ name , $ table , $ columns ) { echo "    > alter table $table add constraint $name primary key (" . ( is_array ( $ columns ) ? implode ( ',' , $ columns ) : $ columns ) . ") ..." ; $ time = microtime ( true ) ; $ this -> getDbConnection ( ) -> createCommand ( ) -> addPrimaryKey ( $ name , $ table , $ columns ) ; echo " done (time: " . sprintf ( '%.3f' , microtime ( true ) - $ time ) . "s)\n" ; }
Builds and executes a SQL statement for creating a primary key, supports composite primary keys.
@param string $name name of the primary key constraint to add
@param string $table name of the table to add primary key to
@param string|array $columns comma separated string or array of columns that the primary key will consist of.
Array value can be passed since 1.1.14.
@since 1.1.13
Builds and executes a SQL statement for creating a primary key supports composite primary keys .