/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('accounts', function (Blueprint $table) {
         $table->string('destiny_membershipId', 64);
         $table->dropIndex('accounts_id_index');
         $table->index('destiny_membershipId');
     });
     \Onyx\Account::chunk(100, function ($accounts) {
         foreach ($accounts as $account) {
             $data = \Onyx\Destiny\Objects\Data::where('account_id', $account->id)->first();
             $account->destiny_membershipId = $data->membershipId;
             $account->save();
         }
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('comments', function (Blueprint $table) {
         $table->integer('account_id', false, true);
     });
     // Loop all comments, find account_id via membershipId
     \Onyx\Objects\Comment::chunk(100, function ($comments) {
         foreach ($comments as $comment) {
             $data = \Onyx\Destiny\Objects\Data::where('membershipId', $comment->membershipId)->first();
             if ($data instanceof \Onyx\Destiny\Objects\Data) {
                 $comment->account_id = $data->account_id;
                 $comment->save();
             }
         }
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('game_players', function (Blueprint $table) {
         $table->integer('account_id', false, true);
     });
     // Loop all game_players, find the account_id via membershipId on DestinyData
     \Onyx\Destiny\Objects\GamePlayer::chunk(100, function ($players) {
         foreach ($players as $player) {
             $data = \Onyx\Destiny\Objects\Data::where('membershipId', $player->membershipId)->first();
             if ($data instanceof \Onyx\Destiny\Objects\Data) {
                 $player->account_id = $data->account_id;
                 $player->save();
             }
         }
     });
 }