1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/database/migrations/2015_05_27_121828_add_tasks.php

56 lines
1.7 KiB
PHP
Raw Normal View History

2015-05-27 18:52:10 +02:00
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
2017-01-30 17:05:31 +01:00
class AddTasks extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tasks', function ($table) {
2015-05-27 18:52:10 +02:00
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedInteger('account_id')->index();
$table->unsignedInteger('client_id')->nullable();
$table->unsignedInteger('invoice_id')->nullable();
$table->timestamps();
$table->softDeletes();
2015-06-14 14:21:29 +02:00
$table->timestamp('start_time')->nullable();
2015-05-27 18:52:10 +02:00
$table->integer('duration')->nullable();
$table->string('description')->nullable();
$table->boolean('is_deleted')->default(false);
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
$table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
$table->unsignedInteger('public_id')->index();
2017-01-30 17:05:31 +01:00
$table->unique(array('account_id','public_id'));
2015-05-27 18:52:10 +02:00
});
Schema::dropIfExists('timesheets');
Schema::dropIfExists('timesheet_events');
Schema::dropIfExists('timesheet_event_sources');
Schema::dropIfExists('project_codes');
Schema::dropIfExists('projects');
2017-01-30 17:05:31 +01:00
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
2015-05-27 18:52:10 +02:00
Schema::drop('tasks');
2017-01-30 17:05:31 +01:00
}
2015-05-27 18:52:10 +02:00
}