本文整理匯總了PHP中Illuminate\Database\Schema\Blueprint::primary方法的典型用法代碼示例。如果您正苦於以下問題:PHP Blueprint::primary方法的具體用法?PHP Blueprint::primary怎麽用?PHP Blueprint::primary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Schema\Blueprint
的用法示例。
在下文中一共展示了Blueprint::primary方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
protected function create(Blueprint $table)
{
$table->create();
$table->integer('user_id')->unsigned();
$table->integer('topic_id')->unsigned();
$table->primary(array('user_id', 'topic_id'));
}
示例2: create
protected function create(Blueprint $table)
{
$table->create();
$table->string('conf_name', 255)->default('');
$table->text('conf_value')->nullable();
$table->primary('conf_name');
}
示例3: create
protected function create(Blueprint $table)
{
$table->create();
$table->integer('group_id')->unsigned();
$table->integer('forum_id')->unsigned();
$table->boolean('read_forum')->default(true);
$table->boolean('post_replies')->default(true);
$table->boolean('post_topics')->default(true);
$table->primary(array('group_id', 'forum_id'));
}
示例4: create
protected function create(Blueprint $table)
{
$table->create();
$table->string('id', 40);
$table->integer('user_id')->unsigned()->default(1);
$table->integer('created')->unsigned()->default(0);
$table->integer('last_activity')->unsigned()->default(0);
$table->string('last_ip', 200)->default('0.0.0.0');
$table->text('payload');
$table->primary('id');
$table->index('user_id');
}
示例5: testAddingPrimaryKey
public function testAddingPrimaryKey()
{
$blueprint = new Blueprint('users');
$blueprint->primary('foo', 'bar');
$statements = $blueprint->toSql($this->getGrammar());
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table "users" add constraint bar primary key ("foo")', $statements[0]);
}
示例6: modifyIncrement
/**
* Get the SQL for an auto-increment column modifier.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
* @param \Illuminate\Support\Fluent $column
* @return string|null
*/
protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
{
if (in_array($column->type, $this->serials) && $column->autoIncrement) {
$blueprint->primary($column->name);
}
}
示例7: modifyIncrement
/**
* Get the SQL for an auto-increment column modifier.
*
* @param Illuminate\Database\Schema\Blueprint $blueprint
* @param Illuminate\Support\Fluent $column
* @return string|null
*/
protected function modifyIncrement(Blueprint $blueprint, Fluent $column)
{
if ($column->type == 'integer' and $column->autoIncrement) {
$blueprint->primary($column->name);
}
}
示例8: primary
/**
* Store list primary to create i18n
*
* @param array|string $columns
* @param null $name
*
* @return \Illuminate\Support\Fluent
*/
public function primary($columns, $name = null)
{
$this->addCachePrimary($columns);
return parent::primary($columns, $name);
}