fix batch issue
This commit is contained in:
@@ -8,6 +8,10 @@ class AddBatchNumberToReimbursements extends Migration
|
|||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
if (! $this->db->tableExists('reimbursements') || $this->db->fieldExists('batch_number', 'reimbursements')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
'batch_number' => [
|
'batch_number' => [
|
||||||
'type' => 'INT',
|
'type' => 'INT',
|
||||||
@@ -24,7 +28,8 @@ class AddBatchNumberToReimbursements extends Migration
|
|||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
if ($this->db->tableExists('reimbursements') && $this->db->fieldExists('batch_number', 'reimbursements')) {
|
||||||
$this->forge->dropColumn('reimbursements', 'batch_number');
|
$this->forge->dropColumn('reimbursements', 'batch_number');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
+8
@@ -8,6 +8,11 @@ class AddYearlyBatchNumberToReimbursementBatches extends Migration
|
|||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
if (! $this->db->tableExists('reimbursement_batches')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $this->db->fieldExists('yearly_batch_number', 'reimbursement_batches')) {
|
||||||
$fields = [
|
$fields = [
|
||||||
'yearly_batch_number' => [
|
'yearly_batch_number' => [
|
||||||
'type' => 'INT',
|
'type' => 'INT',
|
||||||
@@ -20,14 +25,17 @@ class AddYearlyBatchNumberToReimbursementBatches extends Migration
|
|||||||
];
|
];
|
||||||
|
|
||||||
$this->forge->addColumn('reimbursement_batches', $fields);
|
$this->forge->addColumn('reimbursement_batches', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
$this->fillExistingBatchNumbers();
|
$this->fillExistingBatchNumbers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
|
if ($this->db->tableExists('reimbursement_batches') && $this->db->fieldExists('yearly_batch_number', 'reimbursement_batches')) {
|
||||||
$this->forge->dropColumn('reimbursement_batches', 'yearly_batch_number');
|
$this->forge->dropColumn('reimbursement_batches', 'yearly_batch_number');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function fillExistingBatchNumbers(): void
|
private function fillExistingBatchNumbers(): void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user