Migrations, Seeders, Models, Resources for User, Client, Project, Team, Mastertask, Subtask, Timeblock, Timesheet, Attachment

This commit is contained in:
StudioTem committed 2023-01-24 17:38:24 +01:00
1 parent 30ae7dab84
commit 8d88c0c4e6
35 files changed
+910 -14

No files matched your search

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('clients', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('code');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('clients');
}
};
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('projects', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Client::class);
$table->string('name');
$table->string('code');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('projects');
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('clients', function (Blueprint $table) {
$table->unique('code');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('projects', function (Blueprint $table) {
$table->unique('code');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};
@@ -0,0 +1,40 @@
<?php
use App\Models\Project;
use App\Models\Team;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('master_tasks', function (Blueprint $table) {
$table->id();
$table->foreignIdFor( Project::class);
$table->foreignIdFor( Team::class)->nullable();
$table->string('title');
$table->float('estimated_time')->comment('tento field sa updatuje automaticky na zaklade subtaskov');
$table->float('tracked_time')->default(0)->comment('tento field sa updatuje automaticky na zaklade vykazov subtaskov');
$table->timestamp('deadline');
$table->boolean('is_finished')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('master_task');
}
};
@@ -0,0 +1,40 @@
<?php
use App\Models\MasterTask;
use App\Models\Project;
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sub_tasks', function (Blueprint $table) {
$table->id();
$table->foreignIdFor( MasterTask::class);
$table->foreignIdFor( User::class);
$table->float('estimated_time');
$table->float('tracked_time')->default(0)->comment('tento field sa updatuje automaticky na zaklade vykazov');
$table->boolean('is_finished')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sub_tasks');
}
};
@@ -0,0 +1,39 @@
<?php
use App\Models\MasterTask;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('attachments', function (Blueprint $table) {
$table->id();
$table->foreignIdFor( MasterTask::class);
$table->string('original_name');
$table->string('disk_name');
$table->string('path');
$table->string('extension');
$table->string('content_type');
$table->bigInteger('file_size');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('attachments');
}
};
@@ -0,0 +1,37 @@
<?php
use App\Models\SubTask;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('timesheets', function (Blueprint $table) {
$table->id();
$table->foreignIdFor( SubTask::class);
$table->foreignIdFor( User::class);
$table->float('time', 4);
$table->timestamp( 'synced_to_karat')->nullable()->default(null);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('timesheets');
}
};
@@ -0,0 +1,35 @@
<?php
use App\Models\SubTask;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('timeblocks', function (Blueprint $table) {
$table->id();
$table->foreignIdFor( SubTask::class);
$table->timestamp( 'start');
$table->timestamp( 'end');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('timeblocks');
}
};