mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-17 04:32:15 +01:00
Fixed data type of project and task spend time
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('projects', function (Blueprint $table): void {
|
||||||
|
$table->bigInteger('spent_time')->unsigned()->default(0)->change();
|
||||||
|
});
|
||||||
|
Schema::table('tasks', function (Blueprint $table): void {
|
||||||
|
$table->bigInteger('spent_time')->unsigned()->default(0)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('projects', function (Blueprint $table): void {
|
||||||
|
$table->integer('spent_time')->unsigned()->default(0)->change();
|
||||||
|
});
|
||||||
|
Schema::table('tasks', function (Blueprint $table): void {
|
||||||
|
$table->integer('spent_time')->unsigned()->default(0)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -185,4 +185,19 @@ class ProjectModelTest extends ModelTestAbstract
|
|||||||
// Assert
|
// Assert
|
||||||
$this->assertFalse($isArchived);
|
$this->assertFalse($isArchived);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_project_can_store_big_amounts_of_spent_time(): void
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
$project = Project::factory()->create();
|
||||||
|
$spentTime = 100 * 365 * 24 * 60 * 60; // 100 years in seconds
|
||||||
|
|
||||||
|
// Act
|
||||||
|
$project->spent_time = $spentTime;
|
||||||
|
$project->save();
|
||||||
|
$project->refresh();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
$this->assertSame($spentTime, $project->spent_time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,4 +114,19 @@ class TaskModelTest extends ModelTestAbstract
|
|||||||
// Assert
|
// Assert
|
||||||
$this->assertFalse($task->is_done);
|
$this->assertFalse($task->is_done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_task_can_store_big_amounts_of_spent_time(): void
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
$task = Task::factory()->create();
|
||||||
|
$spentTime = 100 * 365 * 24 * 60 * 60; // 100 years in seconds
|
||||||
|
|
||||||
|
// Act
|
||||||
|
$task->spent_time = $spentTime;
|
||||||
|
$task->save();
|
||||||
|
$task->refresh();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
$this->assertSame($spentTime, $task->spent_time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user