1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Start working on TimeSheet feature

This commit is contained in:
Troels Liebe Bentsen 2014-10-01 02:46:35 +02:00
parent 89ab09f90c
commit 5613f39ce5
2 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,137 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimesheets extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('projects', function($t) {
$t->increments('id');
$t->unsignedInteger('user_id');
$t->unsignedInteger('account_id')->index();
$t->timestamps();
$t->softDeletes();
$t->string('name');
$t->string('description');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$t->foreign('account_id')->references('id')->on('accounts');
$t->unique( array('account_id','name') );
});
Schema::create('project_codes', function($t) {
$t->increments('id');
$t->unsignedInteger('user_id');
$t->unsignedInteger('account_id')->index();
$t->unsignedInteger('project_id');
$t->timestamps();
$t->softDeletes();
$t->string('name');
$t->string('description');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$t->foreign('account_id')->references('id')->on('accounts');
$t->foreign('project_id')->references('id')->on('projects')->onDelete('cascade');
$t->unique( array('account_id','name') );
});
Schema::create('timesheets', function($t) {
$t->increments('id');
$t->unsignedInteger('user_id');
$t->unsignedInteger('account_id')->index();
$t->timestamps();
$t->softDeletes();
$t->dateTime('start_date');
$t->dateTime('end_date');
$t->float('discount');
$t->decimal('hours');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$t->foreign('account_id')->references('id')->on('accounts');
$t->unsignedInteger('public_id');
$t->unique( array('account_id','public_id') );
});
Schema::create('timesheet_events', function($t) {
$t->increments('id');
$t->unsignedInteger('user_id');
$t->unsignedInteger('account_id')->index();
$t->unsignedInteger('timesheet_source_id');
$t->unsignedInteger('timesheet_id')->nullable()->index();
$t->unsignedInteger('project_id')->nullable()->index();
$t->unsignedInteger('project_code_id')->nullable()->index();
$t->timestamps();
$t->softDeletes();
$t->string('summary');
$t->string('uid');
$t->text('description');
$t->string('location');
$t->string('owner');
$t->dateTime('start_date');
$t->dateTime('end_date');
$t->decimal('hours');
$t->float('discount');
$t->timeStamp('org_created_at');
$t->timeStamp('org_updated_at');
$t->string('org_start_date_timezone');
$t->string('org_end_date_timezone');
$t->text('org_data');
$t->foreign('account_id')->references('id')->on('accounts');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$t->foreign('timesheet_source_id')->references('id')->on('timesheets')->onDelete('cascade');
$t->unique( array('timesheet_source_id', 'uid') );
});
Schema::create('timesheet_sources', function($t) {
$t->increments('id');
$t->unsignedInteger('user_id');
$t->unsignedInteger('account_id')->index();
$t->timestamps();
$t->softDeletes();
$t->string('name');
$t->string('url');
$t->enum('type', array('ical', 'googlexml'));
$t->string('owner');
$t->foreign('account_id')->references('id')->on('accounts');
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('projects');
Schema::drop('project_codes');
Schema::drop('timesheets');
Schema::drop('timesheet_events');
Schema::drop('timesheet_sources');
}
}

7
app/models/TimeSheet.php Executable file
View File

@ -0,0 +1,7 @@
<?php
class InvoiceStatus extends Eloquent
{
public $timestamps = false;
protected $softDelete = false;
}