update
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddReceiptIdToOperations extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$this->forge->addColumn('operations', [
|
||||
'receipt_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true, 'after' => 'category_id'],
|
||||
]);
|
||||
// Kasacja paragonu nie kasuje operacji, tylko zrywa powiazanie.
|
||||
$this->forge->addForeignKey('receipt_id', 'receipts', 'id', 'SET NULL', 'SET NULL', 'operations_receipt_id_fk');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$this->forge->dropForeignKey('operations', 'operations_receipt_id_fk');
|
||||
$this->forge->dropColumn('operations', 'receipt_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user