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->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')); }
public static function _schema_imageModel(Blueprint $table) { $table->string('image'); $table->string('url'); $table->unsignedInteger('order')->default(0); $table->string('type')->default('default'); $table->integer('width'); $table->integer('height'); $table->morphs('imageable'); return $table; }
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'); }
protected function buildDynamicTable(Blueprint $table) { $block_index = 'FK_' . $this->getDynamicTableName() . '_block_id_blocks'; $page_index = 'FK_' . $this->getDynamicTableName() . '_page_id_pages'; $table->increments('id'); $table->integer('block_id')->unsigned()->nullable(); $table->integer('page_id')->unsigned()->nullable(); $table->integer('is_shared')->unsigned()->nullable(); $table->foreign('block_id', $block_index)->references('id')->on('blocks')->onUpdate('CASCADE')->onDelete('SET NULL'); $table->foreign('page_id', $page_index)->references('id')->on('pages')->onUpdate('CASCADE')->onDelete('SET NULL'); $table->timestamps(); }
/** * @return Blueprint|null */ public function getBlueprint() { if ($this->hasPivotTable()) { $left = $this->buildLeftColumnName(); $right = $this->getColumn(); $table = $this->getTable(); $blueprint = new Blueprint($table); $blueprint->increments('id'); $blueprint->integer($left); $blueprint->integer($right); return $blueprint; } }
/** * @param Blueprint $table * @return Blueprint */ public static function _schema_chinaArea(Blueprint $table) { $table->integer('areano'); $table->integer('parentno'); $table->string('name'); $table->string('province')->nullable(); $table->string('city')->nuallable(); $table->string('distinct')->nullable(); $table->enum('flag', ['国家', '省', '市', '区/县']); $table->integer('sort')->default(99); $table->integer('zipcode')->default(0); return $table; }
public static function _schema_usermodel(\Illuminate\Database\Schema\Blueprint $table) { $table->string('username', 100); $table->string('nickname', 30)->unique(); $table->string('email', 100); $table->string('mobile', 20); $table->integer('exp')->default(0); $table->integer('points')->default(0); $table->date('birthdate')->nullable(); $table->enum('gender', ['男', '女', '保密'])->default('保密'); $table->string('password', 100); $table->string('remember_token', 100); $table->timestamp('last_login'); return $table; }
protected function create(Blueprint $table) { $table->create(); $table->increments('id'); $table->string('title', 50)->default(''); $table->integer('parent_group_id')->unsigned()->nullable(); }
protected function create(Blueprint $table) { $table->create(); $table->increments('id'); $table->string('poster', 200)->default(''); $table->integer('poster_id')->unsigned()->default(1); $table->string('poster_ip', 39)->nullable(); $table->text('message')->nullable(); $table->boolean('hide_smilies')->default(false); $table->integer('posted')->unsigned()->default(0); $table->integer('edited')->unsigned()->nullable(); $table->string('edited_by', 200)->nullable(); $table->integer('conversation_id')->unsigned(); $table->index('conversation_id'); $table->index(['poster_id', 'conversation_id']); }
/** * Create the table schema. * * @param Blueprint $table * * @return mixed */ protected function create(Blueprint $table) { $table->increments('id'); $table->string('task'); $table->text('data')->nullable(); $table->string('state')->default(JobState::IDLE); $table->text('message')->nullable(); $table->boolean('schedulable')->default(false); $table->integer('attempts')->default(0); $table->integer('retries')->default(0); $table->timestamp('started_at')->nullable(); $table->timestamp('completed_at')->nullable(); $table->timestamp('expires_at')->nullable(); $table->timestamp('run_at')->nullable(); $table->timestamps(); }
/** * Activates the table. * * @param \Illuminate\Database\Schema\Blueprint $table */ public function activate(Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('handle'); $table->string('url'); $table->integer('set_id'); }
protected function create(Blueprint $table) { $table->create(); $table->increments('id'); $table->integer('group_id')->unsigned(); $table->string('name', 50); $table->boolean('value'); }
/** * @param Blueprint $table * @return Blueprint */ public static function _schema_ResetPasswordTokens(Blueprint $table) { $table->string('key')->index(); $table->string('token'); $table->integer('user_id')->index(); $table->dateTime('expires_at'); return $table; }
protected function create(Blueprint $table) { $table->create(); $table->string('slug', 100)->primary(); $table->string('name'); $table->integer('position')->default(0); $table->boolean('conversations_enabled')->default(true); $table->timestamps(); }
public static function _schema_roles(\Illuminate\Database\Schema\Blueprint $table) { $table->integer('parent_id'); $table->string('name')->unique(); $table->longText('permissions'); $table->string('title'); $table->text('desc')->nullable(); return $table; }
protected function buildDynamicTable(Blueprint $table) { $reference_column = $this->getDynamicType() . '_id'; $reference_table = $this->getDynamicType() . 's'; $reference_index = 'FK_' . $this->getDynamicTableName() . '_' . $reference_column . '_' . $reference_table; $table->increments('id'); $table->integer($reference_column)->unsigned()->nullable(); $table->foreign($reference_column, $reference_index)->references('id')->on($reference_table)->onUpdate('CASCADE')->onDelete('SET NULL'); $table->timestamps(); }
/** * @param Blueprint $table table * @return Blueprint */ private function documentSchema(Blueprint $table) { $table->string('parentId', 255)->default(''); $table->string('instanceId', 255)->default(''); // users $table->string('userType', '16')->default('normal'); $table->string('userId', 255); $table->string('writer', 255); $table->string('email')->nullable(); // 비회원 작성일때 email 받기? $table->string('certifyKey', 255); // nonmember document's password // count $table->integer('readCount')->default(0); $table->integer('commentCount')->default(0); $table->integer('assentCount')->default(0); $table->integer('dissentCount')->default(0); // display contents config values $table->enum('approved', array('approved', 'waiting', 'rejected'))->default('approved'); $table->enum('published', array('published', 'waiting', 'reserved', 'rejected'))->default('published'); // temp 대신 draft가 어떨까? $table->enum('status', array('public', 'temp', 'trash', 'private', 'notice'))->default('public'); $table->enum('display', array('visible', 'secret', 'hidden'))->default('visible'); // search $table->string('locale', 255)->default(''); // multi-language support. ko, en, jp, ... $table->string('title', 255); $table->text('content'); $table->text('pureContent'); $table->timestamp('createdAt'); $table->timestamp('publishedAt'); $table->timestamp('updatedAt'); $table->timestamp('deletedAt')->nullable(); // 대댓글 처리를 위한 트리용 컬럼 추가 ex.) head, parent, depth $table->string('head', 50); // timestamp + uuid (ex. 1430369257-bd1fc797-474f-47a6-bedb-867a376490f2) $table->string('reply', 200)->nullable(); $table->string('listOrder', 250); $table->string('ipaddress', 16); $table->index('createdAt'); $table->unique(['head', 'reply']); return $table; }
/** * @param Blueprint $table * @return Blueprint */ public static function _schema_LoginableTrait(Blueprint $table) { $table->string('password')->nullable(); $table->rememberToken('remember_token'); $table->dateTime('last_login')->nullable(); $table->string('last_ip')->nullable(); $table->integer('fails')->default(0); $table->enum('is_banned', [0, 1])->default(0); $table->text('ban_reason')->nullable(); $table->enum('locked_screen', [0, 1])->default(0); return $table; }
/** * Add the field type column. * * @param Blueprint $table * @param AssignmentInterface $assignment */ public function addColumn(Blueprint $table, AssignmentInterface $assignment) { // Skip if the column already exists. if ($this->schema->hasColumn($table->getTable(), $this->fieldType->getColumnName() . '_id')) { return; } $table->string($this->fieldType->getColumnName() . '_type')->nullable(!$assignment->isRequired()); $table->integer($this->fieldType->getColumnName() . '_id')->nullable(!$assignment->isRequired()); if ($assignment->isUnique() && $assignment->isTranslatable()) { $table->unique([$this->fieldType->getColumnName() . '_type', $this->fieldType->getColumnName() . '_id']); } }
/** * Give me the tools and I will tell you what my schema is... * * @param Blueprint $table The blueprint for the database table. * @return Blueprint The designed database table schema. */ public static function describeSchema(Blueprint $table) { $table->increments('id'); $table->string('uuid', 36); $table->integer('playhead')->unsigned(); $table->text('metadata'); $table->text('payload'); $table->string('recorded_on', 32); $table->text('type'); $table->unique(['uuid', 'playhead']); return $table; }
/** * @param Blueprint $table table * @return Blueprint */ private function setColumns(Blueprint $table) { $table->string('parentId', 255)->default(''); $table->string('instanceId', 255)->default(''); $table->string('type', 255)->default(''); // users $table->string('userType', '16')->default('normal'); $table->string('userId', 255); $table->string('writer', 255); $table->string('email')->nullable(); // 비회원 작성일때 email 받기? $table->string('certifyKey', 255); // nonmember document's password // count $table->integer('readCount')->default(0); $table->integer('commentCount')->default(0); $table->integer('assentCount')->default(0); $table->integer('dissentCount')->default(0); // display contents config values $table->integer('approved')->default(Document::APPROVED_APPROVED); $table->integer('published')->default(Document::PUBLISHED_PUBLISHED); $table->integer('status')->default(Document::STATUS_PUBLIC); $table->integer('display')->default(Document::DISPLAY_VISIBLE); $table->integer('format')->default(Document::FORMAT_HTML); // search $table->string('locale', 255)->default(''); $table->string('title', 255); $table->text('content'); $table->text('pureContent'); $table->timestamp('createdAt'); $table->timestamp('updatedAt'); $table->timestamp('publishedAt')->nullable(); $table->timestamp('deletedAt')->nullable(); $table->string('head', 50); $table->string('reply', 200); $table->string('ipaddress', 16); $table->index('createdAt'); $table->unique(['head', 'reply']); return $table; }
protected function create(Blueprint $table) { $table->create(); $table->increments('id'); $table->string('category_slug', 100)->nullable()->index(); $table->string('title'); $table->string('poster', 200)->default(''); $table->integer('posted')->unsigned()->default(0); $table->integer('first_post_id')->unsigned()->default(0); $table->integer('last_post')->unsigned()->default(0); $table->integer('last_post_id')->unsigned()->default(0); $table->string('last_poster', 200)->nullable(); $table->integer('num_views')->unsigned()->default(0); $table->integer('num_replies')->unsigned()->default(0); $table->timestamps(); }
/** * Campo Inteiro. */ public function integer($column, $unsigned = false, $autoIncrement = false) { $col = parent::integer(strtolower($column), $autoIncrement, $unsigned); $col->default(0); return $col; }
public function testAddingInteger() { $blueprint = new Blueprint('users'); $blueprint->integer('foo'); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" add "foo" int not null', $statements[0]); $blueprint = new Blueprint('users'); $blueprint->integer('foo', true); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" add "foo" int identity primary key not null', $statements[0]); }
public function testAddingInteger() { $blueprint = new Blueprint('users'); $blueprint->integer('foo'); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table `users` add `foo` int not null', $statements[0]); $blueprint = new Blueprint('users'); $blueprint->integer('foo', true); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table `users` add `foo` int not null auto_increment primary key', $statements[0]); }
public static function _schema_favoriteTrait(\Illuminate\Database\Schema\Blueprint $table) { $table->integer('favorites')->default(0); $table->integer('favorites_real')->default(0); return $table; }
/** * Activates the table. * * @param \Illuminate\Database\Schema\Blueprint $table */ public function activate(Blueprint $table) { $table->increments('id'); $table->integer('set_id'); $table->integer('share_id'); }
public static function _schema_userwithroles(\Illuminate\Database\Schema\Blueprint $table) { $table->integer('role_id'); return $table; }
function addAttachFieldAttachableId(Blueprint $table) { $table->integer('attachable_id')->nullable(); }