2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
2021-06-10 13:15:52 -07:00
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-06-10 13:15:52 -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');
|
2021-06-10 13:15:52 -07:00
|
|
|
$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) {
|
2021-06-10 13:15:52 -07:00
|
|
|
$table->integer('consumable_id')->nullable()->default(null);
|
|
|
|
});
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
Schema::create('consumables_users', function ($table) {
|
2016-03-25 01:18:05 -07:00
|
|
|
$table->increments('id');
|
2021-06-10 13:15:52 -07:00
|
|
|
$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();
|
|
|
|
});
|
2021-06-10 13:15:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
Schema::drop('consumables');
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
Schema::table('asset_logs', function ($table) {
|
|
|
|
$table->dropColumn('consumable_id');
|
|
|
|
});
|
2016-03-25 01:18:05 -07:00
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
Schema::drop('consumables_users');
|
|
|
|
}
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|