Update 20250626144501_modify_borrow_reason_in_asset_management_journal.php

This commit is contained in:
Luca Haid
2025-07-22 14:10:11 +00:00
parent 4bb094c22f
commit 1b61609a31

View File

@@ -10,6 +10,7 @@ final class ModifyBorrowReasonInAssetManagementJournal extends AbstractMigration
*/
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table('AssetManagementJournal');
$table->changeColumn('borrowReason', 'text', [
'null' => true,
@@ -17,6 +18,7 @@ final class ModifyBorrowReasonInAssetManagementJournal extends AbstractMigration
'after' => 'returnDate',
]);
$table->update();
}
}
/**
@@ -24,6 +26,7 @@ final class ModifyBorrowReasonInAssetManagementJournal extends AbstractMigration
*/
public function down(): void
{
if($this->getEnvironment() == "thetool") {
// Reverting the changes made in the up() method.
// This assumes the column was NOT NULL and had no comment previously.
$table = $this->table('AssetManagementJournal');
@@ -32,5 +35,6 @@ final class ModifyBorrowReasonInAssetManagementJournal extends AbstractMigration
'comment' => 'Reason for borrowing the asset', // Set comment back to empty
]);
$table->update();
}
}
}