Rework on product name/description and translate
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?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()
|
||||
{
|
||||
DB::statement('RENAME TABLE ab_product_translate TO product_translate');
|
||||
DB::statement('ALTER TABLE product_translate MODIFY product_id int unsigned DEFAULT NULL');
|
||||
DB::statement('ALTER TABLE product_translate MODIFY language_id int unsigned DEFAULT NULL');
|
||||
|
||||
DB::statement('ALTER TABLE product_translate RENAME COLUMN name TO name_short');
|
||||
DB::statement('ALTER TABLE product_translate RENAME COLUMN description_short TO name_detail');
|
||||
DB::statement('ALTER TABLE product_translate RENAME COLUMN description_full TO description');
|
||||
|
||||
Schema::table('product_translate', function (Blueprint $table) {
|
||||
$table->dropForeign('ab_product_translate_site_id_foreign');
|
||||
$table->dropIndex('ab_product_translate_id_site_id_index');
|
||||
$table->dropIndex('ab_product_translate_site_id_foreign');
|
||||
|
||||
$table->foreign(['language_id'])->references(['id'])->on('languages');
|
||||
$table->foreign(['product_id','site_id'])->references(['id','site_id'])->on('products');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
abort(500,'Cant go back');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user