本文整理汇总了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);
}