FleetCart/app/Scaffold/Module/stubs/migrations/create-translation-table-migration.stub

36 lines
991 B
Plaintext
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Create$ENTITY_NAME$TranslationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('$SNAKE_CASE_ENTITY_NAME$_translations', function (Blueprint $table) {
$table->increments('id');
$table->integer('$SNAKE_CASE_ENTITY_NAME$_id')->unsigned();
$table->string('locale');
$table->unique(['$SNAKE_CASE_ENTITY_NAME$_id', 'locale']);
$table->foreign('$SNAKE_CASE_ENTITY_NAME$_id')->references('id')->on('$PLURAL_SNAKE_CASE_ENTITY_NAME$')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('$SNAKE_CASE_ENTITY_NAME$_translations');
}
}