This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddDescriptionToInvoices extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! $this->db->tableExists('invoices') || $this->db->fieldExists('description', 'invoices')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->forge->addColumn('invoices', [
|
||||
'description' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => true,
|
||||
'after' => 'status',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->db->tableExists('invoices') && $this->db->fieldExists('description', 'invoices')) {
|
||||
$this->forge->dropColumn('invoices', 'description');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user