snipe-it/database/migrations/2016_03_08_225351_create_components_table.php
Laravel Shift 934afa036f Adopt Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions.

You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started.

[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
2021-06-10 20:15:52 +00:00

62 lines
2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateComponentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('components', function ($table) {
$table->increments('id');
$table->string('name')->nullable()->default(null);
$table->integer('category_id')->nullable()->default(null);
$table->integer('location_id')->nullable()->default(null);
$table->integer('company_id')->nullable()->default(null);
$table->integer('user_id')->nullable()->default(null);
$table->integer('total_qty')->default(1);
$table->integer('order_number')->nullable()->default(null);
$table->date('purchase_date')->nullable()->default(null);
$table->decimal('purchase_cost', 13, 4)->nullable()->default(null);
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
Schema::table('asset_logs', function ($table) {
$table->integer('component_id')->nullable()->default(null);
});
Schema::create('components_assets', function ($table) {
$table->increments('id');
$table->integer('user_id')->nullable()->default(null);
$table->integer('assigned_qty')->nullable()->default(1);
$table->integer('component_id')->nullable()->default(null);
$table->integer('asset_id')->nullable()->default(null);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::dropIfExists('components');
Schema::dropIfExists('components_assets');
Schema::table('asset_logs', function ($table) {
$table->dropColumn('component_id');
});
}
}