/** * Activates the table. * * @param \Illuminate\Database\Schema\Blueprint $table */ public function activate(Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('slug'); $table->enum('type', ['PROFILE', 'SHARE'])->default('PROFILE'); }
protected function create(Blueprint $table) { $table->create(); $table->increments('id'); $table->string('title', 50)->default(''); $table->integer('parent_group_id')->unsigned()->nullable(); }
/** * Activates the table. * * @param \Illuminate\Database\Schema\Blueprint $table */ public function activate(Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('slug'); $table->string('url'); $table->boolean('default_set'); }
/** * 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'); }
/** * Create the table schema. * * @param Blueprint $table * * @return mixed */ protected function create(Blueprint $table) { $table->increments('id'); $table->unsignedInteger('job_id'); $table->string('name'); $table->unique(['job_id', 'name']); $table->timestamps(); }
protected function create(Blueprint $table) { $table->create(); $table->increments('id'); $table->integer('group_id')->unsigned(); $table->string('name', 50); $table->boolean('value'); }
/** * Create the table schema. * * @param Blueprint $table * * @return mixed */ protected function create(Blueprint $table) { $table->increments('id'); $table->text('public_id'); $table->text('secret_key'); $table->string('type'); $table->text('data'); $table->timestamps(); }
/** * * @param sting $table * @return $this */ public function table($table) { $this->table = $table; $this->blueprint = new Blueprint($table); if (!Schema::hasTable($table)) { $this->blueprint->create(); $this->blueprint->increments('id'); } return $this; }
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(); }
/** * 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; }
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; } }
/** * 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(); }
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(); }
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']); }
/** * @param Blueprint $table * @return Blueprint */ public static function _schema(Blueprint $table) { $class = get_called_class(); $ref = new \ReflectionClass($class); $methods = $ref->getMethods(\ReflectionMethod::IS_STATIC); $table->engine = 'InnoDB'; $table->increments('id'); foreach ($methods as $method) { if (preg_match('/^_schema_.*/', $method->name)) { $name = $method->name; $table = static::$name($table); } } $table->softDeletes(); $table->timestamps(); return $table; }
private function ifNoUsersTable(Blueprint $table) { $table->increments('id'); $table->string('first_name'); $table->string('last_name'); $table->string('email')->unique(); $table->string('avatar'); $table->string('provider'); $table->string('provider_id')->unique(); $table->longText('provider_token'); $table->string('password', 60)->nullable(); $table->boolean('verified')->default(false); $table->string('gender')->nullable(); $table->string('link'); $table->rememberToken(); $table->timestamps(); }
protected function create(Blueprint $table) { $table->create(); $table->increments('id'); $table->integer('group_id')->unsigned()->default(3); $table->string('username', 200)->default(''); $table->string('password', 60)->default(''); $table->string('email', 80)->default(''); $table->string('title', 50)->nullable(); $table->string('realname', 40)->nullable(); $table->string('url', 100)->nullable(); $table->string('location', 30)->nullable(); $table->text('signature')->nullable(); $table->integer('disp_topics')->unsigned()->nullable(); $table->integer('disp_posts')->unsigned()->nullable(); $table->integer('email_setting')->unsigned()->default(1); $table->boolean('notify_with_post')->default(false); $table->boolean('auto_notify')->default(false); $table->boolean('show_smilies')->default(true); $table->boolean('show_img')->default(true); $table->boolean('show_img_sig')->default(true); $table->boolean('show_avatars')->default(true); $table->boolean('show_sig')->default(true); $table->float('timezone')->default(0); $table->boolean('dst')->default(false); $table->integer('time_format')->unsigned()->default(0); $table->integer('date_format')->unsigned()->default(0); $table->string('language', 25)->default(''); $table->string('style', 25)->default(''); $table->integer('num_posts')->unsigned()->default(0); $table->integer('last_post')->unsigned()->nullable(); $table->integer('last_search')->unsigned()->nullable(); $table->integer('last_email_sent')->unsigned()->nullable(); $table->integer('last_report_sent')->unsigned()->nullable(); $table->integer('registered')->unsigned()->default(0); $table->string('registration_ip', 35)->default('0.0.0.0'); $table->integer('last_visit')->unsigned()->default(0); $table->string('admin_note', 30)->nullable(); $table->string('activate_string', 80)->nullable(); $table->string('activate_key', 8)->nullable(); $table->string('remember_token')->nullable(); $table->unique('username'); $table->index('registered'); }
public function testAddingIncrementingID() { $blueprint = new Blueprint('users'); $blueprint->increments('id'); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" add "id" int identity primary key not null', $statements[0]); }
public function testAddingIncrementingID() { $blueprint = new Blueprint('users'); $blueprint->increments('id'); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table `users` add `id` int not null auto_increment primary key', $statements[0]); }
/** * 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'); }
/** * Creates the table. * * @param \Illuminate\Database\Schema\Blueprint $table */ public function activate(Blueprint $table) { $table->increments('id'); $table->string('address', 100); $table->timestamps(); }
/** * @param string $column * * @return Fluent */ public function increments($column) { $result = parent::increments($column); $this->addCachePrimary($column); return $result; }
public function testBasicSelectNotUsingQuotes() { $blueprint = new Blueprint('users'); $blueprint->create(); $blueprint->increments('id'); $blueprint->string('email'); $conn = $this->getConnection(); $statements = $blueprint->toSql($conn, $this->getGrammar(false)); $this->assertEquals(1, count($statements)); $this->assertEquals('create table users ( id number(10,0) not null, email varchar2(255) not null, constraint users_id_primary primary key ( id ) )', $statements[0]); }
/** * @param Blueprint $table * * @return \Illuminate\Support\Fluent */ public function setDatabaseFieldType(Blueprint $table) { return $table->increments($this->getDBKey()); }
/** * @return array */ public function buildBlueprints() { $blueprint = new Blueprint($this->table); if (!Schema::hasTable($this->table)) { $blueprint->increments('id'); if ($this->timestamps) { $blueprint->timestamps(); } } $blueprints[] = $blueprint; // Only add column that doesn't exist in the database yet foreach ($this->columns as $name => $column) { if (!Schema::hasColumn($this->table, $name)) { $blueprint->{$column->getType()}($name); } } foreach ($this->relations as $relation) { if ($relation->hasPivotTable()) { $table = $relation->getBlueprint()->getTable(); if (!Schema::hasTable($table)) { $blueprints[] = $relation->getBlueprint(); } } else { if (!Schema::hasColumn($this->table, $relation->getColumn())) { $blueprint->integer($relation->getColumn()); } } } return $blueprints; }