update migration
All checks were successful
All checks were successful
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user