Skip to content

A free open source IT asset/license management system

Wrap migration in check

Marcus Moore039564e74caf
diff --git a/database/migrations/2025_08_12_225214_add_qty_to_checkout_acceptances_table.php b/database/migrations/2025_08_12_225214_add_qty_to_checkout_acceptances_table.php
index 2bb32b0e90..c5c7726213 100644
--- a/database/migrations/2025_08_12_225214_add_qty_to_checkout_acceptances_table.php
+++ b/database/migrations/2025_08_12_225214_add_qty_to_checkout_acceptances_table.php
@@ -10,8 +10,10 @@ return new class extends Migration {
*/
public function up(): void
{
- Schema::table('checkout_acceptances', function (Blueprint $table) {
- $table->unsignedInteger('qty')->nullable()->after('assigned_to_id')->default(null);
+ Schema::whenTableDoesntHaveColumn('checkout_acceptances', 'qty', function () {
+ Schema::table('checkout_acceptances', function (Blueprint $table) {
+ $table->unsignedInteger('qty')->nullable()->after('assigned_to_id')->default(null);
+ });
});
}
@@ -20,8 +22,10 @@ return new class extends Migration {
*/
public function down(): void
{
- Schema::table('checkout_acceptances', function (Blueprint $table) {
- $table->dropColumn('qty');
+ Schema::whenTableHasColumn('checkout_acceptances', 'qty', function () {
+ Schema::table('checkout_acceptances', function (Blueprint $table) {
+ $table->dropColumn('qty');
+ });
});
}
};