clqms-be/app/Database/Migrations/2026-02-26-090320_AddTestSiteIDToTestmap.php

30 lines
745 B
PHP
Raw Normal View History

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddTestSiteIDToTestmap extends Migration
{
public function up()
{
$this->forge->addColumn('testmap', [
'TestSiteID' => [
'type' => 'INT',
'unsigned' => true,
'null' => true,
'after' => 'TestMapID'
]
]);
// Add foreign key if it doesn't exist
$this->forge->addForeignKey('TestSiteID', 'testdefsite', 'TestSiteID', 'CASCADE', 'CASCADE');
}
public function down()
{
$this->forge->dropForeignKey('testmap', 'testmap_TestSiteID_foreign');
$this->forge->dropColumn('testmap', 'TestSiteID');
}
}