-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15446 from Godmartinz/barcode_settings_hide
Refactored Barcode Settings into Label Settings
- Loading branch information
Showing
9 changed files
with
255 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
database/migrations/2024_10_31_212512_update_new_and_drop_old_barcode_settings.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up() | ||
{ | ||
// Copy values if target columns are blank | ||
DB::table('settings')->whereNull('label2_2d_type')->orWhere('label2_2d_type', '')->update([ | ||
'label2_2d_type' => DB::raw('barcode_type') | ||
]); | ||
|
||
DB::table('settings')->whereNull('label2_1d_type')->orWhere('label2_1d_type', '')->update([ | ||
'label2_1d_type' => DB::raw('alt_barcode') | ||
]); | ||
|
||
|
||
Schema::table('settings', function (Blueprint $table) { | ||
$table->dropColumn(['barcode_type', 'alt_barcode']); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
Schema::table('settings', function (Blueprint $table) { | ||
// Re-add the columns that were dropped in case of rollback | ||
$table->string('barcode_type')->nullable(); | ||
$table->string('alt_barcode')->nullable(); | ||
}); | ||
|
||
DB::table('settings')->whereNull('barcode_type')->orWhere('barcode_type', '')->update([ | ||
'barcode_type' => DB::raw('label2_2d_type') | ||
]); | ||
|
||
DB::table('settings')->whereNull('alt_barcode')->orWhere('alt_barcode', '')->update([ | ||
'alt_barcode' => DB::raw('label2_1d_type') | ||
]); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.