Redo database migrations for pgsql
This commit is contained in:
45
database/migrations/0203-create_product_translate.php
Normal file
45
database/migrations/0203-create_product_translate.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('product_translate', function(Blueprint $table)
|
||||
{
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->integer('site_id')->unsigned();
|
||||
|
||||
$table->string('name_short',128);
|
||||
$table->text('name_detail')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
|
||||
$table->integer('language_id')->unsigned();
|
||||
$table->foreign(['language_id'])->references(['id'])->on('languages');
|
||||
|
||||
$table->integer('product_id')->unsigned();
|
||||
$table->foreign(['product_id','site_id'])->references(['id','site_id'])->on('products');
|
||||
|
||||
$table->unique(['product_id','language_id','site_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('product_translate');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user