Created
August 31, 2015 17:24
-
-
Save khaeransori/2343767d97428e121cb9 to your computer and use it in GitHub Desktop.
Contoh migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
class CreateProductsTable extends Migration { | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('products', function(Blueprint $table) | |
{ | |
$table->char('id', 36); | |
$table->char('manufacturer_id', 36)->nullable(); | |
$table->char('default_category_id', 36)->nullable(); | |
$table->string('name'); | |
$table->longText('description')->nullable(); | |
$table->string('reference_code', 32)->unique(); | |
$table->decimal('price', 20, 6)->default(0); | |
$table->decimal('sale_price', 20,6)->default(0); | |
$table->boolean('active'); | |
$table->timestamps(); | |
$table->softDeletes(); | |
$table->primary('id'); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::drop('products'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment