removed discounts table

This commit is contained in:
Prashant Singh 2019-05-07 20:47:23 +05:30
parent 8a7a142414
commit a36776732b
8 changed files with 19 additions and 177 deletions

View File

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDiscountsTable extends Migration
class CreateCatalogRulesTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ class CreateDiscountsTable extends Migration
*/
public function up()
{
Schema::create('discounts', function (Blueprint $table) {
Schema::create('catalog_rules', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
@ -26,6 +26,6 @@ class CreateDiscountsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('discounts');
Schema::dropIfExists('catalog_rules');
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDiscountRulesTable extends Migration
class CreateCheckoutRulesTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ class CreateDiscountRulesTable extends Migration
*/
public function up()
{
Schema::create('discount_rules', function (Blueprint $table) {
Schema::create('checkout_rules', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
@ -26,6 +26,6 @@ class CreateDiscountRulesTable extends Migration
*/
public function down()
{
Schema::dropIfExists('discount_rules');
Schema::dropIfExists('checkout_rules');
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDiscountChannelsTable extends Migration
class CreateCatalogProductsTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ class CreateDiscountChannelsTable extends Migration
*/
public function up()
{
Schema::create('discount_channels', function (Blueprint $table) {
Schema::create('catalog_products', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
@ -26,6 +26,6 @@ class CreateDiscountChannelsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('discount_channels');
Schema::dropIfExists('catalog_products');
}
}

View File

@ -113,7 +113,7 @@
<div class="control-group" :key="index" style="display: flex; flex-direction: row; align-content: center; justify-content: flex-start;">
<span style="padding-top: 18px; margin-right: 15px;">Attribute is </span>
<select class="control" name="attributes[][attribute]" v-model="attrs[index].attribute" v-validate="'required'" style="width: 120px; margin-right: 15px;">
<select class="control" name="attributes[][attribute]" v-model="attrs[index].attribute" v-validate="'required'" style="width: 120px; height: 60px; margin-right: 15px;" title="You Can Make Multiple Selections Here" multiple>
<option disabled="disabled">Select attribute</option>
<option v-for="attribute in attributes" :value="attribute.id">@{{ attribute.name }}</option>
</select>
@ -131,9 +131,9 @@
<div v-for="(cat, index) in cats">
<div class="control-group" :key="index" style="display: flex; flex-direction: row; align-content: center; justify-content: flex-start;">
<span style="padding-top: 18px; margin-right: 15px;">Category </span>
<span style="padding-top: 18px; height: 60px; margin-right: 15px;">Category </span>
<select class="control" name="attributes[][condition]" v-model="cats[index].condition" v-validate="'required'" style="width: 120px; margin-right: 15px;"">
<select class="control" name="attributes[][condition]" v-model="cats[index].condition" v-validate="'required'" style="width: 120px; margin-right: 15px;" title="You Can Make Multiple Selections Here" multiple>
<option>is</option>
<option>is any of</option>
</select>

View File

@ -1,62 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterDiscountsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('discounts', function (Blueprint $table) {
$table->string('name');
$table->string('type');
$table->text('description')->nullable();
$table->boolean('status')->default(0);
$table->dateTime('starts_from');
$table->dateTime('ends_till');
$table->integer( 'priority')->unsigned();
$table->boolean('ends_subsequent')->default(false);
$table->boolean('is_all')->default(1);
});
Schema::table('discount_channels', function (Blueprint $table) {
$table->integer('discount_id')->unsigned();
$table->foreign('discount_id')->references('id')->on('discounts')->onDelete('cascade');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
});
Schema::table('discount_customer_group', function (Blueprint $table) {
$table->integer('discount_id')->unsigned();
$table->foreign('discount_id')->references('id')->on('discounts')->onDelete('cascade');
$table->integer('customer_group_id')->unsigned();
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('discounts', function (Blueprint $table) {
$table->dropColumn('name');
$table->dropColumn('type');
$table->dropColumn('description');
$table->dropColumn( 'status');
$table->dropColumn( 'starts_from');
});
Schema::dropIfExists('discount_channels');
Schema::dropIfExists('discount_customer_group');
}
}

View File

@ -1,50 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCouponsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('coupons', function (Blueprint $table) {
$table->increments('id');
$table->boolean('auto_generate')->default(0);
$table->string('prefix')->nullable();
$table->string('suffix')->nullable();
$table->integer('spaces_per_characters')->default(4);
$table->integer('discount_id')->unsigned();
$table->foreign('discount_id')->references('id')->on('discounts')->onDelete('cascade');
$table->integer('allowed_uses')->unsigned();
$table->integer('allowed_uses_per_customer')->unsigned();
$table->timestamps();
});
Schema::create('coupon_codes', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->boolean('status')->default(0);
$table->integer('coupon_id')->unsigned();
$table->foreign('coupon_id')->references('id')->on('coupons')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('coupons');
Schema::dropIfExists('coupon_codes');
}
}

View File

@ -1,46 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddColumnInDiscountRulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('discount_rules', function (Blueprint $table) {
Schema::table('discount_rules', function (Blueprint $table) {
$table->json('conditions');
$table->json('actions');
$table->integer('discount_id')->unsigned();
$table->foreign('discount_id')->references('id')->on('discounts');
$table->integer('coupon_id')->unsigned()->nullable();
$table->foreign('coupon_id')->references('id')->on('coupons');
$table->json('label')->nullable();
});
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('discount_rules', function (Blueprint $table) {
$table->dropColumn('conditions');
$table->dropColumn('actions');
$table->dropForeign('discount_id');
$table->dropColumn('discount_id');
$table->dropForeign('coupon_id');
$table->dropColumn('coupon_id');
$table->dropColumn('label');
});
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDiscountCustomerGroupsTable extends Migration
class DropAllDiscountsTable extends Migration
{
/**
* Run the migrations.
@ -13,10 +13,10 @@ class CreateDiscountCustomerGroupsTable extends Migration
*/
public function up()
{
Schema::create('discount_customer_group', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
Schema::dropIfExists('discount_customer_group');
Schema::dropIfExists('discount_channels');
Schema::dropIfExists('discount_rules');
Schema::dropIfExists('discounts');
}
/**
@ -26,6 +26,6 @@ class CreateDiscountCustomerGroupsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('discount_customer_group');
//
}
}
}