Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Baakoma committed Oct 21, 2024
1 parent d486131 commit 1a19260
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ class MigrateYearPeriodYearToVacationLimits extends Command

public function handle(): void
{
DB::table("vacation_limits")
->join("year_periods", "year_periods.id", "=", "vacation_limits.year_period_id")
->update(["vacation_limits.year" => DB::raw("year_periods.year")]);
DB::statement("
UPDATE vacation_limits
SET year = year_periods.year
FROM year_periods
WHERE year_periods.id = vacation_limits.year_period_id
");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ public function up(): void
{
Schema::table("vacation_limits", function (Blueprint $table): void {
$table->integer("year")->nullable();
});

Artisan::call(MigrateYearPeriodYearToVacationLimits::class);
Artisan::call(MigrateYearPeriodYearToVacationLimits::class);

Schema::table("vacation_limits", function (Blueprint $table): void {
$table->integer("year")->nullable(false)->change();
$table->dropConstrainedForeignId("year_period_id");
});
Expand Down

0 comments on commit 1a19260

Please sign in to comment.