DONE: feature flags by branches

This commit is contained in:
ISMAIL MASSERAN
2026-09-08 14:48:13 +08:00
parent f58a0cf702
commit 22279af86c
9 changed files with 298 additions and 2 deletions
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCawanganFeatureTable extends Migration
{
/**
* Master DB (mysql7) — per-cawangan feature flags.
*
* Missing row = off. Enable a pilot after migrate:
*
* INSERT INTO cawangan_feature (kodcaw, feature, enabled, created_at, updated_at)
* VALUES ('X0301', 'pembiayaan_online', 1, NOW(), NOW())
* ON DUPLICATE KEY UPDATE enabled = 1;
*/
public function up()
{
if (!Schema::connection('mysql7')->hasTable('cawangan_feature')) {
Schema::connection('mysql7')->create('cawangan_feature', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('kodcaw', 20);
$table->string('feature', 64);
$table->tinyInteger('enabled')->default(0);
$table->timestamps();
$table->unique(['kodcaw', 'feature'], 'uniq_cawangan_feature');
});
}
}
public function down()
{
Schema::connection('mysql7')->dropIfExists('cawangan_feature');
}
}