46 lines
938 B
PHP
46 lines
938 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Capsule\Manager as Capsule;
|
|
|
|
class ArticleVariants extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
$builder = Capsule::schema();
|
|
|
|
$builder->create(
|
|
'variants',
|
|
function ($table) {
|
|
$table->increments('id');
|
|
|
|
$table->unsignedInteger('article_id');
|
|
$table->foreign('article_id')->references('id')->on('articles');
|
|
|
|
$table->string('name');
|
|
$table->string('short');
|
|
$table->float('price', 8, 2);
|
|
|
|
$table->timestamps();
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
$builder = Capsule::schema();
|
|
|
|
$builder->drop('variants');
|
|
}
|
|
}
|