Last active
May 2, 2020 17:14
-
-
Save tanthammar/b5abf6e31296503e0dcc34c18c7cbbed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Support\Facades\Schema; | |
class AddIndexToTranslatedNamesTable extends Migration | |
{ | |
protected $tables = ['organizers', 'events', 'bookers', | |
'categories', 'terms', 'tabs', 'helps', | |
'products', 'rentals', 'services', 'articles']; | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
$tables = $this->tables; | |
foreach ($tables as $table) { | |
Schema::table($table, function (Blueprint $table) { | |
$table->string('name_sv')->virtualAs('name->>"$.sv"'); | |
$table->index('name_sv'); | |
$table->string('name_en')->virtualAs('name->>"$.en"'); | |
$table->index('name_en'); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment