snipe-it/database/migrations/2015_06_10_003554_create_consumables.php

59 lines
1.6 KiB
PHP
Raw Normal View History

2016-03-25 01:18:05 -07:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
2016-03-25 01:18:05 -07:00
class CreateConsumables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('consumables', function ($table) {
2016-03-25 01:18:05 -07:00
$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('user_id')->nullable()->default(null);
2016-03-25 01:18:05 -07:00
$table->integer('qty')->default(0);
$table->boolean('requestable')->default(0);
$table->timestamps();
$table->softDeletes();
$table->engine = 'InnoDB';
});
Schema::table('asset_logs', function ($table) {
$table->integer('consumable_id')->nullable()->default(null);
});
2016-03-25 01:18:05 -07:00
Schema::create('consumables_users', function ($table) {
2016-03-25 01:18:05 -07:00
$table->increments('id');
$table->integer('user_id')->nullable()->default(null);
$table->integer('consumable_id')->nullable()->default(null);
$table->integer('assigned_to')->nullable()->default(null);
2016-03-25 01:18:05 -07:00
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('consumables');
2016-03-25 01:18:05 -07:00
Schema::table('asset_logs', function ($table) {
$table->dropColumn('consumable_id');
});
2016-03-25 01:18:05 -07:00
Schema::drop('consumables_users');
}
2016-03-25 01:18:05 -07:00
}