hasTable('transactions')) { return true; } Schema::connection('mongodb')->create('transactions', function (Blueprint $collection) { $collection->unsignedBigInteger('user_id')->index(); $collection->unsignedBigInteger( 'type' )->index(); $collection->unsignedBigInteger('payment')->index(); $collection->unsignedBigInteger( 'module_id' )->index()->nullable(); $collection->unsignedBigInteger('host_id')->index()->nullable(); // a year $year = 365 * 24 * 60 * 60; $collection->expire('created_at', $year); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::connection('mongodb')->dropIfExists('transactions'); } };