完善生产异常维修与备件管理功能
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return new class {
|
||||
public function up(Builder $schema): void
|
||||
{
|
||||
if (!$schema->hasTable('produce_exception_record')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$schema->table('produce_exception_record', function (Blueprint $table) use ($schema): void {
|
||||
if (!$schema->hasColumn('produce_exception_record', 'process_id')) {
|
||||
$table->bigInteger('process_id')->nullable()->comment('异常提报工序ID');
|
||||
$table->index('process_id', 'idx_exception_record_process_id');
|
||||
}
|
||||
if (!$schema->hasColumn('produce_exception_record', 'step_id')) {
|
||||
$table->bigInteger('step_id')->nullable()->comment('异常提报步骤ID');
|
||||
$table->index('step_id', 'idx_exception_record_step_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(Builder $schema): void
|
||||
{
|
||||
if (!$schema->hasTable('produce_exception_record')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$schema->table('produce_exception_record', function (Blueprint $table) use ($schema): void {
|
||||
if ($schema->hasColumn('produce_exception_record', 'process_id')) {
|
||||
$table->dropIndex('idx_exception_record_process_id');
|
||||
$table->dropColumn('process_id');
|
||||
}
|
||||
if ($schema->hasColumn('produce_exception_record', 'step_id')) {
|
||||
$table->dropIndex('idx_exception_record_step_id');
|
||||
$table->dropColumn('step_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user