This commit is contained in:
2026-07-12 19:21:35 +02:00
parent f2d944b117
commit 41cb412cb0
49 changed files with 3170 additions and 52 deletions
@@ -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');
}
}