protected function create(Blueprint $table) { $table->create(); $table->integer('user_id')->unsigned(); $table->integer('topic_id')->unsigned(); $table->primary(array('user_id', 'topic_id')); }
protected function create(Blueprint $table) { $table->create(); $table->string('conf_name', 255)->default(''); $table->text('conf_value')->nullable(); $table->primary('conf_name'); }
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')); }
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'); }
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]); }
/** * 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); } }
/** * 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); } }
/** * 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); }