GrafiteInc/Commerce

View on GitHub
src/Migrations/2015_10_03_021904_create_products_table.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProductsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create(config('cms.db-prefix', '').'products', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('url');
            $table->string('code')->nullable();
            $table->integer('price');
            $table->string('weight')->nullable();
            $table->string('width')->nullable();
            $table->string('height')->nullable();
            $table->string('depth')->nullable();
            $table->integer('discount')->default(0);
            $table->string('hero_image')->nullable();
            $table->string('notification')->nullable();
            $table->string('discount_type')->nullable();
            $table->date('discount_start_date')->nullable();
            $table->date('discount_end_date')->nullable();
            $table->integer('stock')->default(0);
            $table->integer('is_available')->default(0);
            $table->integer('is_published')->default(0);
            $table->integer('is_download')->default(0);
            $table->integer('is_featured')->default(0);
            $table->string('file')->nullable();
            $table->string('seo_description')->nullable();
            $table->string('seo_keywords')->nullable();
            $table->text('details')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::drop(config('cms.db-prefix', '').'products');
    }
}