update migration
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m27s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
Build, Push and Deploy / deploy-staging (push) Successful in 23s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-05 17:18:42 +07:00
parent 30de18d283
commit 3b3a1da5c3
7 changed files with 92 additions and 78 deletions

View File

@@ -11,6 +11,7 @@
*/
public function up(): void
{
if (!Schema::hasTable('employees')) {
Schema::create('employees', function (Blueprint $table) {
$table->id();
$table->string('name');
@@ -30,6 +31,7 @@ public function up(): void
$table->timestamps();
});
}
}
/**
* Reverse the migrations.

View File

@@ -11,6 +11,7 @@
*/
public function up(): void
{
if (!Schema::hasTable('leave_types')) {
Schema::create('leave_types', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
@@ -20,6 +21,7 @@ public function up(): void
$table->timestamps();
});
}
}
/**
* Reverse the migrations.

View File

@@ -11,6 +11,7 @@
*/
public function up(): void
{
if (!Schema::hasTable('leaves')) {
Schema::create('leaves', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
@@ -26,6 +27,7 @@ public function up(): void
$table->timestamps();
});
}
}
/**
* Reverse the migrations.

View File

@@ -11,6 +11,7 @@
*/
public function up(): void
{
if (!Schema::hasTable('holidays')) {
Schema::create('holidays', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
@@ -21,6 +22,7 @@ public function up(): void
$table->timestamps();
});
}
}
/**
* Reverse the migrations.

View File

@@ -11,6 +11,7 @@
*/
public function up(): void
{
if (!Schema::hasTable('attendances')) {
Schema::create('attendances', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
@@ -25,6 +26,7 @@ public function up(): void
$table->timestamps();
});
}
}
/**
* Reverse the migrations.

View File

@@ -11,6 +11,7 @@
*/
public function up(): void
{
if (!Schema::hasTable('payrolls')) {
Schema::create('payrolls', function (Blueprint $table) {
$table->id();
$table->foreignId('business_id')->constrained()->cascadeOnDelete();
@@ -25,6 +26,7 @@ public function up(): void
$table->timestamps();
});
}
}
/**
* Reverse the migrations.

View File

@@ -12,11 +12,13 @@ public function up(): void
{
// HOLIDAYS, ATTENDANCES, LEAVES, PAYROLLS, employees
foreach (['holidays', 'attendances', 'leaves', 'payrolls', 'employees'] as $tableName) {
if (!Schema::hasColumn($tableName, 'branch_id')) {
Schema::table($tableName, function (Blueprint $table) {
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
});
}
}
}
public function down(): void
{