Пример #1
0
 /**
  * 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();
 }
 /**
  * Add confirmation columns.
  *
  * @param  \Illuminate\Database\Schema\Blueprint  $table
  */
 private function addConfirmationColumns(Blueprint $table)
 {
     if (UserConfirmator::isEnabled()) {
         $table->boolean('is_confirmed')->default(0);
         $table->string('confirmation_code', UserConfirmator::getLength())->nullable();
         $table->timestamp('confirmed_at')->nullable();
     }
 }
 /**
  * @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;
 }
Пример #4
0
 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 testAddingTimeStamp()
 {
     $blueprint = new Blueprint('users');
     $blueprint->timestamp('foo');
     $statements = $blueprint->toSql($this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('alter table "users" add "foo" datetime not null', $statements[0]);
 }
 /**
  * @param Blueprint $table
  *
  * @return \Illuminate\Support\Fluent
  */
 public function setDatabaseFieldType(Blueprint $table)
 {
     return $table->timestamp($this->getDBKey());
 }
 public function testAddingTimeStamp()
 {
     $blueprint = new Blueprint('users');
     $blueprint->timestamp('foo');
     $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('alter table users add ( foo timestamp default 0 not null )', $statements[0]);
 }
 /**
  * @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;
 }