first upload all files
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrdersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('orders', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('customer_id')->nullable()->index();
|
||||
$table->string('customer_email');
|
||||
$table->string('customer_phone')->nullable();
|
||||
$table->string('customer_first_name');
|
||||
$table->string('customer_last_name');
|
||||
$table->string('billing_first_name');
|
||||
$table->string('billing_last_name');
|
||||
$table->string('billing_address_1');
|
||||
$table->string('billing_address_2')->nullable();
|
||||
$table->string('billing_city');
|
||||
$table->string('billing_state');
|
||||
$table->string('billing_zip');
|
||||
$table->string('billing_country');
|
||||
$table->string('shipping_first_name');
|
||||
$table->string('shipping_last_name');
|
||||
$table->string('shipping_address_1');
|
||||
$table->string('shipping_address_2')->nullable();
|
||||
$table->string('shipping_city');
|
||||
$table->string('shipping_state');
|
||||
$table->string('shipping_zip');
|
||||
$table->string('shipping_country');
|
||||
$table->decimal('sub_total', 18, 4)->unsigned();
|
||||
$table->string('shipping_method');
|
||||
$table->decimal('shipping_cost', 18, 4)->unsigned();
|
||||
$table->integer('coupon_id')->nullable()->index();
|
||||
$table->decimal('discount', 18, 4)->unsigned();
|
||||
$table->decimal('total', 18, 4)->unsigned();
|
||||
$table->string('payment_method');
|
||||
$table->string('currency');
|
||||
$table->decimal('currency_rate', 18, 4);
|
||||
$table->string('locale');
|
||||
$table->string('status');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('orders');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrderProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order_products', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('order_id')->unsigned();
|
||||
$table->integer('product_id')->unsigned();
|
||||
$table->decimal('unit_price', 18, 4)->unsigned();
|
||||
$table->integer('qty');
|
||||
$table->decimal('line_total', 18, 4)->unsigned();
|
||||
|
||||
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
|
||||
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_products');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrderProductOptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order_product_options', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('order_product_id')->unsigned();
|
||||
$table->integer('option_id')->unsigned();
|
||||
|
||||
$table->unique(['order_product_id', 'option_id']);
|
||||
$table->foreign('order_product_id')->references('id')->on('order_products')->onDelete('cascade');
|
||||
$table->foreign('option_id')->references('id')->on('options')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_product_options');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrderProductOptionValuesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order_product_option_values', function (Blueprint $table) {
|
||||
$table->integer('order_product_option_id')->unsigned();
|
||||
$table->integer('option_value_id')->unsigned();
|
||||
$table->decimal('price', 18, 4)->unsigned()->nullable();
|
||||
|
||||
$table->primary(['order_product_option_id', 'option_value_id'], 'order_product_option_id_option_value_id_primary');
|
||||
$table->foreign('order_product_option_id')->references('id')->on('order_product_options')->onDelete('cascade');
|
||||
$table->foreign('option_value_id')->references('id')->on('option_values')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_product_option_values');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrderTaxesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order_taxes', function (Blueprint $table) {
|
||||
$table->integer('order_id')->unsigned();
|
||||
$table->integer('tax_rate_id')->unsigned();
|
||||
$table->decimal('amount', 15, 4)->unsigned();
|
||||
|
||||
$table->primary(['order_id', 'tax_rate_id']);
|
||||
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
|
||||
$table->foreign('tax_rate_id')->references('id')->on('tax_rates')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_taxes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddValueColumnToOrderProductOptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('order_product_options', function (Blueprint $table) {
|
||||
$table->text('value')->nullable()->after('option_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('order_product_options', function (Blueprint $table) {
|
||||
$table->dropColumn('value');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddNoteColumnToOrdersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->text('note')->nullable()->after('status');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropColumn('note');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeShippingMethodColumnInOrdersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::statement('ALTER TABLE orders MODIFY shipping_method VARCHAR(191)');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrderDownloadsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order_downloads', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('order_id')->unsigned();
|
||||
$table->integer('file_id')->unsigned();
|
||||
|
||||
$table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade');
|
||||
$table->foreign('file_id')->references('id')->on('files')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_downloads');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user