first upload all files
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFlashSalesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('flash_sales', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('flash_sales');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFlashSaleTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('flash_sale_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('flash_sale_id')->unsigned();
|
||||
$table->string('locale');
|
||||
$table->string('campaign_name');
|
||||
|
||||
$table->unique(['flash_sale_id', 'locale']);
|
||||
$table->foreign('flash_sale_id')->references('id')->on('flash_sales')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('flash_sale_translations');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFlashSaleProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('flash_sale_products', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('flash_sale_id')->unsigned();
|
||||
$table->integer('product_id')->unsigned();
|
||||
$table->date('end_date');
|
||||
$table->decimal('price', 18, 4)->unsigned();
|
||||
$table->integer('qty');
|
||||
$table->integer('position');
|
||||
|
||||
$table->foreign('flash_sale_id')->references('id')->on('flash_sales')->onDelete('cascade');
|
||||
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('flash_sale_products');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFlashSaleProductOrdersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('flash_sale_product_orders', function (Blueprint $table) {
|
||||
$table->integer('flash_sale_product_id')->unsigned();
|
||||
$table->integer('order_id')->unsigned();
|
||||
$table->integer('qty');
|
||||
|
||||
$table->primary(['flash_sale_product_id', 'order_id']);
|
||||
$table->foreign('flash_sale_product_id')->references('id')->on('flash_sale_products')->onDelete('cascade');
|
||||
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('flash_sale_product_orders');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user