Exemplo n.º 1
1
 public static function _schema_profilemodel(\Illuminate\Database\Schema\Blueprint $table)
 {
     $table->unsignedInteger('user_id');
     $table->text('avatar');
     $table->index(['user_id']);
     return $table;
 }
 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;
 }
Exemplo n.º 3
0
 /**
  * Add default nested set columns to the table. Also create an index.
  *
  * @param \Illuminate\Database\Schema\Blueprint $table
  */
 public static function columns(Blueprint $table)
 {
     $table->unsignedInteger(self::LFT);
     $table->unsignedInteger(self::RGT);
     $table->unsignedInteger(self::PARENT_ID)->nullable();
     $table->index(self::getDefaultColumns());
 }
Exemplo n.º 4
0
 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']);
 }
 public function testIndexDefaultNames()
 {
     $blueprint = new Blueprint('users');
     $blueprint->unique(array('foo', 'bar'));
     $commands = $blueprint->getCommands();
     $this->assertEquals('users_foo_bar_unique', $commands[0]->index);
     $blueprint = new Blueprint('users');
     $blueprint->index('foo');
     $commands = $blueprint->getCommands();
     $this->assertEquals('users_foo_index', $commands[0]->index);
 }
Exemplo n.º 6
0
 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');
 }
Exemplo n.º 7
0
 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');
 }
 /**
  * @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;
 }
Exemplo n.º 9
0
 /**
  * Criar indice, respeitando se deve ou nao adicionar o inquilno.
  */
 public function index($columns, $name = null, $withTenant = false)
 {
     $columns = (array) $columns;
     // Verificar se deve adicionar a coluna do inquilino
     if ($withTenant && in_array(self::tenantField(), $columns) != true) {
         $columns = array_merge([], [self::tenantField()], $columns);
     }
     return parent::index($columns, $name);
 }
 public function testAddingIndex()
 {
     $blueprint = new Blueprint('users');
     $blueprint->index(array('foo', 'bar'), 'baz');
     $statements = $blueprint->toSql($this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('create index baz on "users" ("foo", "bar")', $statements[0]);
 }
 public function testAddingIndex()
 {
     $blueprint = new Blueprint('users');
     $blueprint->index(array('foo', 'bar'), 'baz');
     $statements = $blueprint->toSql($this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('alter table `users` add index baz(`foo`, `bar`)', $statements[0]);
 }
Exemplo n.º 12
0
 public static function _schema_switchableTable(\Illuminate\Database\Schema\Blueprint $table)
 {
     $table->enum('switch', ['启用', '禁用']);
     $table->index(['switch']);
     return $table;
 }
 public function testAddingIndex()
 {
     $blueprint = new Blueprint('users');
     $blueprint->index(['foo', 'bar'], 'baz');
     $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('create index baz on users ( foo, bar )', $statements[0]);
 }
Exemplo n.º 14
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;
 }