Ejemplo n.º 1
0
 private function migrateTables()
 {
     Schema::create('users', function ($table) {
         $table->increments('id');
         $table->string('username');
         $table->timestamps();
     });
     Schema::create('posts', function ($table) {
         $table->integer('user_id')->unsigned()->nullable();
         $table->increments('id');
         $table->string('title');
         $table->text('description');
         $table->timestamps();
         $table->foreign('user_id')->references('id')->on('users')->onUpdate('restrict')->onDelete('set null');
     });
     Schema::create('revisions', function ($table) {
         $table->increments('id');
         $table->string('revisionable_type');
         $table->integer('revisionable_id');
         $table->integer('user_id')->nullable();
         $table->string('key');
         $table->text('old_value')->nullable();
         $table->text('new_value')->nullable();
         $table->timestamps();
         $table->index(['revisionable_id', 'revisionable_type']);
     });
 }
Ejemplo n.º 2
0
 public function createSchema()
 {
     if (!DbSchema::hasTable('sessions')) {
         try {
             DbSchema::create('sessions', function ($table) {
                 $table->string('id')->unique();
                 $table->longText('payload');
                 $table->integer('last_activity');
             });
         } catch (QueryException $e) {
         }
     }
     $exec = $this->getSystemSchemas();
     $builder = new DbUtils();
     foreach ($exec as $data) {
         // Creates the schema
         if (!method_exists($data, 'get')) {
             break;
         }
         $schemaArray = $data->get();
         if (!is_array($schemaArray)) {
             break;
         }
         foreach ($schemaArray as $table => $columns) {
             $builder->build_table($table, $columns);
         }
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('articles', function (Blueprint $table) {
         $table->increments('id');
         $table->unsignedInteger('category_id')->index();
         $table->string('title')->index();
         $table->string('alias')->index();
         $table->string('author_alias')->nullable()->index();
         $table->string('blade_template')->nullable();
         $table->text('body')->nullable();
         $table->dateTime('publish_up')->nullable();
         $table->dateTime('publish_down')->nullable();
         $table->text('parameters')->nullable();
         $table->unsignedInteger('order')->default(1);
         $table->integer('hits')->default(0);
         $table->boolean('published')->default(false)->index();
         $table->boolean('authenticated')->default(false);
         $table->boolean('featured')->default(false);
         $table->string('authorization', 20)->default('can');
         $table->unsignedInteger('created_by')->nullable()->index();
         $table->unsignedInteger('updated_by')->nullable()->index();
         $table->timestamps();
         $table->foreign('category_id')->references('id')->on('categories');
     });
     Schema::create('article_permission', function (Blueprint $table) {
         $table->unsignedInteger('article_id')->index();
         $table->unsignedInteger('permission_id')->index();
         $table->foreign('article_id')->references('id')->on('articles')->onDelete('cascade');
         $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
     });
 }
 public function up()
 {
     Schema::create('addresses', function (Blueprint $table) {
         $table->increments('id');
         $table->morphs('addressable');
         $table->integer('country_id')->unsigned()->index();
         $table->string('organization')->nullable();
         $table->string('name_prefix');
         $table->string('name_suffix')->nullable();
         $table->string('first_name');
         $table->string('last_name');
         $table->string('street');
         $table->string('building_number')->nullable();
         $table->string('building_flat')->nullable();
         $table->string('city');
         $table->string('city_prefix')->nullable();
         $table->string('city_suffix')->nullable();
         $table->string('state')->nullable();
         $table->string('state_code')->nullable();
         $table->string('postcode');
         $table->string('phone')->nullable();
         $table->float('lat')->nullable();
         $table->float('lng')->nullable();
         foreach (config('addressable.flags', []) as $flag) {
             $table->boolean('is_' . $flag)->default(false)->index();
         }
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('email')->unique();
         $table->string('password');
         $table->boolean('active');
         $table->boolean('banned');
         $table->string('register_ip');
         $table->string('country_code');
         $table->string('locale');
         $table->string('activation_key');
         $table->boolean('su');
         $table->rememberToken();
         $table->timestamps();
     });
     $user = \Laralum::newUser();
     $user->name = env('USER_NAME', 'admin');
     $user->email = env('USER_EMAIL', '*****@*****.**');
     $user->password = bcrypt(env('USER_PASSWORD', 'admin123'));
     $user->active = true;
     $user->banned = false;
     $user->register_ip = "";
     $user->country_code = env('USER_COUNTRY_CODE', 'ES');
     $user->locale = env('USER_LOCALE', 'en');
     $user->activation_key = str_random(25);
     $user->su = true;
     $user->save();
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('attachments', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('path');
         $table->string('extension', 20);
         $table->integer('uploaded_to');
         $table->boolean('external');
         $table->integer('order');
         $table->integer('created_by');
         $table->integer('updated_by');
         $table->index('uploaded_to');
         $table->timestamps();
     });
     // Get roles with permissions we need to change
     $adminRoleId = DB::table('roles')->where('system_name', '=', 'admin')->first()->id;
     // Create & attach new entity permissions
     $ops = ['Create All', 'Create Own', 'Update All', 'Update Own', 'Delete All', 'Delete Own'];
     $entity = 'Attachment';
     foreach ($ops as $op) {
         $permissionId = DB::table('role_permissions')->insertGetId(['name' => strtolower($entity) . '-' . strtolower(str_replace(' ', '-', $op)), 'display_name' => $op . ' ' . $entity . 's', 'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString()]);
         DB::table('permission_role')->insert(['role_id' => $adminRoleId, 'permission_id' => $permissionId]);
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('oauth_grants', function (Blueprint $t) {
         $t->string('id', 40)->primary();
         $t->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('notification_types', function (Blueprint $table) {
         $table->increments('id');
         $table->string('type');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create($this->getTableName(), function (Blueprint $table) {
         $table->string('id', 191);
         $table->text('value')->nullable();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('profesor', function (Blueprint $table) {
         $table->integer('pro_tipo');
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('site_visits', function (Blueprint $table) {
         $table->increments('id');
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('posts', function (Blueprint $table) {
         $table->engine = 'InnoDB';
         $table->increments('id');
         $table->integer('user_id')->unsigned();
         $table->string('title', 191);
         $table->string('slug', 191)->unique();
         $table->string('type', 10);
         $table->string('media', 191);
         $table->string('thumbnail', 191);
         $table->string('featured', 191);
         $table->boolean('safe')->default(true);
         $table->boolean('resized')->default(false);
         $table->boolean('reported')->default(false);
         $table->string('source', 191)->nullable();
         // Cache fields
         $table->integer('reports')->default(0)->unsigned();
         $table->integer('comments')->default(0)->unsigned();
         $table->integer('likes')->default(0)->unsigned();
         $table->integer('dislikes')->default(0)->unsigned();
         $table->integer('points')->default(0);
         $table->timestamps();
         $table->softDeletes();
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('categories', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('roles', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('label')->nullable();
         $table->text('description')->nullable();
         $table->nullableTimestamps();
     });
     Schema::create('permissions', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('label')->nullable();
         $table->text('description')->nullable();
         $table->nullableTimestamps();
     });
     Schema::create('permission_role', function (Blueprint $table) {
         $table->integer('permission_id')->unsigned();
         $table->integer('role_id')->unsigned();
         $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
         $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
         $table->primary(['permission_id', 'role_id']);
     });
     Schema::create('role_user', function (Blueprint $table) {
         $table->integer('role_id')->unsigned();
         $table->integer('user_id')->unsigned();
         $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
         $table->primary(['role_id', 'user_id']);
     });
 }
 /**
  * Run the migrations.
  */
 public function up()
 {
     Schema::create('comments', function (Blueprint $t) {
         $t->engine = 'InnoDB';
         $t->increments('id');
         $t->text('message');
         $t->string('commentable_type');
         $t->integer('commentable_id');
         $t->integer('author_id');
         $t->timestamps();
         $t->integer('project_id');
         $t->string('attachment')->nullable();
         $t->string('line_code')->nullable();
         $t->string('commit_id')->nullable();
         $t->boolean('system')->default(false);
         $t->text('st_diff')->nullable();
         $t->integer('updated_by_id')->nullable();
         $t->boolean('is_award')->default(false);
         $t->softDeletes();
         $t->index('author_id');
         $t->index('commit_id');
         $t->index(['created_at', 'id']);
         $t->index('created_at');
         $t->index('is_award');
         $t->index('line_code');
         $t->index(['commentable_id', 'commentable_type']);
         $t->index('commentable_type');
         $t->index(['project_id', 'commentable_type']);
         $t->index('project_id');
         $t->index('updated_at');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('idUser');
         $table->string('firstname');
         $table->string('name');
         $table->string('email')->unique();
         $table->string('phone');
         $table->string('fixphone');
         $table->string('street');
         $table->integer('codePostal');
         $table->string('town');
         $table->string('country');
         $table->date('birthday');
         $table->string('statut');
         $table->integer('idGie');
         $table->integer('idGaec');
         $table->float('tauxHoraire');
         $table->string('type');
         $table->string('password');
         $table->rememberToken();
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('administradors', function (Blueprint $table) {
         $table->integer('adm_tipo');
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('administrator_user', function (Blueprint $table) {
         $table->increments('id');
         $table->string('status_instance')->default('active');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('picture_types', function (Blueprint $table) {
         $table->increments('id');
         $table->string('type_name');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('account_teams', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('account_id', false, true);
         $table->foreign('account_id', 'teams_to_accounts')->references('id')->on('accounts')->onDelete('cascade');
         $table->timestamps();
     });
     Schema::create('account_teams_translations', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('team_id', false, true);
         $table->foreign('team_id', 'translations_to_teams')->references('id')->on('account_teams')->onDelete('cascade');
         $table->string('locale', 5);
         $table->string('name');
         $table->text('description');
         $table->timestamps();
     });
     Schema::create('account_team_memberships', function (Blueprint $table) {
         $table->integer('team_id', false, true);
         $table->foreign('team_id', 'team_membership_to_team')->references('id')->on('account_teams')->onDelete('cascade');
         $table->integer('membership_id', false, true);
         $table->foreign('membership_id', 'team_membership_to_membership')->references('id')->on('account_memberships')->onDelete('cascade');
         $table->timestamps();
     });
     //install the module itself.
     $module = Module::create(['namespace' => 'team', 'nl' => ['name' => 'Team'], 'en' => ['name' => 'Team'], 'fr' => ['name' => 'Team'], 'de' => ['name' => 'Team']]);
     $module->routes()->save(new ModuleRoute(['name' => 'store.team.index', 'nl' => ['title' => 'team'], 'en' => ['title' => 'team'], 'fr' => ['title' => 'team'], 'de' => ['title' => 'team']]));
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('laravel_sms', function (Blueprint $table) {
         $table->increments('id');
         //to:用于存储手机号
         $table->string('to')->default('');
         //temp_id:存储模板标记,用于存储任何第三方服务商提供的短信模板标记/id
         $table->string('temp_id')->default('');
         //data:模板短信的模板数据,建议json格式
         $table->string('data')->default('');
         //content:内容
         $table->string('content')->default('');
         //voice_code:语言验证码code
         $table->string('voice_code')->default('');
         //发送失败次数
         $table->mediumInteger('fail_times')->default(0);
         //最后一次发送失败时间
         $table->integer('last_fail_time')->unsigned()->default(0);
         //发送成功时的时间
         $table->integer('sent_time')->unsigned()->default(0);
         //代理器使用日志,记录每个代理器的发送状态,可用于排错
         $table->text('result_info');
         $table->timestamps();
         $table->softDeletes();
         $table->engine = 'InnoDB';
         //说明
         //1:temp_id和data用于发送模板短信。
         //2:content用于直接发送短信内容,不使用模板。
         //3:voice_code用于存储语言验证码code。
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('entities', function (Blueprint $table) {
         $table->string('name')->unique()->primary();
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('user_role', function ($t) {
         $t->integer('user_id')->unsigned();
         $t->integer('role_id')->unsigned();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('settings', function (Blueprint $table) {
         $table->string('key')->unique();
         $table->string('value');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('services', function (Blueprint $table) {
         $table->increments('idService');
         $table->string('LibelleService');
     });
 }
Ejemplo n.º 26
0
 public static function setUpBeforeClass()
 {
     if (!isset(self::$app)) {
         self::$app = AppFactory::create();
     }
     if (!Schema::hasTable('users')) {
         Schema::create('users', function ($table) {
             $table->increments('id');
             $table->string('name');
         });
     }
     DB::insert('insert into users (name) values (?)', array('Test User'));
     if (!Schema::hasTable('posts')) {
         Schema::create('posts', function ($table) {
             $table->increments('id');
             $table->string('title');
             $table->integer('created_by')->unsigned()->nullable();
             $table->integer('updated_by')->unsigned()->nullable();
             $table->integer('deleted_by')->unsigned()->nullable();
             $table->timestamps();
             $table->timestamp('deleted_at')->nullable();
             $table->foreign('created_by')->references('id')->on('users');
             $table->foreign('updated_by')->references('id')->on('users');
             $table->foreign('deleted_by')->references('id')->on('users');
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('media', function (Blueprint $table) {
         $table->increments('id');
         $table->string('disk', 32);
         $table->string('directory');
         $table->string('filename');
         $table->string('extension', 32);
         $table->string('mime_type', 128);
         $table->string('aggregate_type', 32);
         $table->integer('size')->unsigned();
         $table->timestamps();
         $table->index(['disk', 'directory']);
         $table->unique(['disk', 'directory', 'filename', 'extension']);
         $table->index('aggregate_type');
     });
     Schema::create('mediables', function (Blueprint $table) {
         $table->integer('media_id')->unsigned();
         $table->string('mediable_type');
         $table->integer('mediable_id')->unsigned();
         $table->string('tag');
         $table->integer('order')->unsigned();
         $table->primary(['media_id', 'mediable_type', 'mediable_id', 'tag']);
         $table->index(['mediable_id', 'mediable_type']);
         $table->index('tag');
         $table->index('order');
         $table->foreign('media_id')->references('id')->on('media')->onDelete('cascade');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('nota_docentes', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('id_cursante')->unsigned();
         $table->integer('id_docente')->unsigned();
         $table->integer('materia_id')->unsigned();
         $table->integer('ua_id')->unsigned();
         $table->integer('indicador1');
         $table->integer('indicador2');
         $table->integer('indicador3');
         $table->integer('indicador4');
         $table->integer('indicador5');
         $table->integer('indicador6');
         $table->integer('indicador7');
         $table->integer('indicador8');
         $table->integer('indicador9');
         $table->integer('indicador10');
         $table->integer('indicador11');
         $table->integer('indicador12');
         $table->integer('indicador13');
         $table->integer('indicador14');
         $table->integer('indicador15');
         $table->integer('indicador16');
         $table->integer('indicador17');
         $table->integer('indicador18');
         $table->integer('indicador19');
         $table->integer('indicador20');
         $table->timestamps();
         $table->foreign('materia_id')->references('id')->on('materias')->onDelete('restrict')->onUpdate('cascade');
         $table->foreign('ua_id')->references('id')->on('unidad_academicas')->onDelete('restrict')->onUpdate('cascade');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('languages', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->string('short_two');
         $table->string('short_three');
         $table->timestamps();
     });
     Schema::create('groups', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->integer('group_id')->nullable()->comment('Refer to self for multidimensional groups');
         $table->timestamps();
     });
     Schema::create('names', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->integer('group_id');
         $table->timestamps();
     });
     Schema::create('values', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->integer('language_id');
         $table->integer('name_id');
         $table->timestamps();
     });
 }
 public function up()
 {
     Schema::create('Competitor', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('surname');
         $table->integer('userId')->unsigned();
         $table->integer('clubId')->unsigned();
         $table->string('picture');
         $table->timestamps();
         $table->foreign('userId')->references('id')->on('Users')->onDelete('cascade');
         $table->foreign('clubId')->references('id')->on('Club')->onDelete('cascade');
         //
         //			$table->foreign('shiaiCategoryId')
         //					->references('id')
         //					->on('ShiaiCategory')
         //					->onDelete('cascade');
         //
         //
         //			$table->foreign('tournamentId')
         //					->references('id')
         //					->on('Tournament')
         //					->onDelete('cascade');
     });
 }