Files
presensi/app/Database/Migrations/2026-02-27-130000_AddGeoFenceToDevicesTable.php
2026-03-05 14:37:36 +07:00

41 lines
1013 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddGeoFenceToDevicesTable extends Migration
{
public function up()
{
$fields = [
'latitude' => [
'type' => 'DECIMAL',
'constraint' => '10,8',
'null' => true,
'after' => 'last_seen_at',
],
'longitude' => [
'type' => 'DECIMAL',
'constraint' => '11,8',
'null' => true,
'after' => 'latitude',
],
'radius_meters' => [
'type' => 'INT',
'constraint' => 11,
'null' => true,
'after' => 'longitude',
],
];
$this->forge->addColumn('devices', $fields);
}
public function down()
{
$this->forge->dropColumn('devices', ['latitude', 'longitude', 'radius_meters']);
}
}