public static function _schema_multiStatusTrait(\Illuminate\Database\Schema\Blueprint $table) { $status = static::$AllowedStatus; $default = $status[0]; $table->enum('status', $status)->default($default); if (isset(static::$StatusDateTime)) { foreach (static::$StatusDateTime as $column) { if (!in_array($column, ['created_at', 'updated_at', 'deleted_at'])) { $table->dateTime($column)->nullable(); } } } $table->index(['status']); 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; }
/** * 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'); }
/** * @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; }
public static function _schema_UserModel(Blueprint $table) { $table->string('email')->nullable()->label('邮箱'); $table->string('mobile')->nullable()->label('手机号码'); $table->string('username')->nullable()->label('姓名'); $table->string('nickname')->nullable()->label('昵称'); $table->enum('gender', ['未填' => '未填', '男' => '男', '女' => '女'])->default('未填')->label('性别'); $table->string('avatar')->nullable()->label('头像'); $table->date('birthday')->nullable()->label('生日'); return $table; }
/** * @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; }
public function testAddingEnum() { $blueprint = new Blueprint('users'); $blueprint->enum('foo', array('bar', 'baz')); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" add "foo" nvarchar(255) not null', $statements[0]); }
public function testAddingEnum() { $blueprint = new Blueprint('users'); $blueprint->enum('foo', array('bar', 'baz')); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table `users` add `foo` enum(\'bar\', \'baz\') not null', $statements[0]); }
public static function _schema_switchableTable(\Illuminate\Database\Schema\Blueprint $table) { $table->enum('switch', ['启用', '禁用']); $table->index(['switch']); return $table; }
public function testAddingEnum() { $blueprint = new Blueprint('users'); $blueprint->enum('foo', ['bar', 'baz']); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table users add ( foo varchar2(255) not null )', $statements[0]); }