update
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('bio_racks', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('bio_racks', 'rack_number')) {
|
||||
$table->integer('rack_number')->nullable()->after('level');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_racks', 'box_number')) {
|
||||
$table->integer('box_number')->nullable()->after('rack_number');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('bio_specimens', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('bio_specimens', 'category_storage')) {
|
||||
$table->string('category_storage', 1)->nullable()->after('specimen_name');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'shelf_number')) {
|
||||
$table->integer('shelf_number')->nullable()->after('category_storage');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'rack_number')) {
|
||||
$table->integer('rack_number')->nullable()->after('shelf_number');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'slot_number')) {
|
||||
$table->integer('slot_number')->nullable()->after('rack_number');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'box_number')) {
|
||||
$table->integer('box_number')->nullable()->after('slot_number');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'tube_number')) {
|
||||
$table->integer('tube_number')->nullable()->after('box_number');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'bacteria_name')) {
|
||||
$table->string('bacteria_name', 200)->nullable()->after('tube_number');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'strain')) {
|
||||
$table->string('strain', 50)->nullable()->after('bacteria_name');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'atcc')) {
|
||||
$table->string('atcc', 150)->nullable()->after('strain');
|
||||
}
|
||||
if (!Schema::hasColumn('bio_specimens', 'input_by')) {
|
||||
$table->string('input_by', 150)->nullable()->after('atcc');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('bio_racks', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('bio_racks', 'rack_number')) {
|
||||
$table->dropColumn('rack_number');
|
||||
}
|
||||
if (Schema::hasColumn('bio_racks', 'box_number')) {
|
||||
$table->dropColumn('box_number');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('bio_specimens', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('bio_specimens', 'category_storage')) {
|
||||
$table->dropColumn('category_storage');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'shelf_number')) {
|
||||
$table->dropColumn('shelf_number');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'rack_number')) {
|
||||
$table->dropColumn('rack_number');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'slot_number')) {
|
||||
$table->dropColumn('slot_number');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'box_number')) {
|
||||
$table->dropColumn('box_number');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'tube_number')) {
|
||||
$table->dropColumn('tube_number');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'bacteria_name')) {
|
||||
$table->dropColumn('bacteria_name');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'strain')) {
|
||||
$table->dropColumn('strain');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'atcc')) {
|
||||
$table->dropColumn('atcc');
|
||||
}
|
||||
if (Schema::hasColumn('bio_specimens', 'input_by')) {
|
||||
$table->dropColumn('input_by');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user