feat: address
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Split wallet address monitoring into two fields:
|
||||
*
|
||||
* monitor — user-facing switch (default ON: "should this address be monitored?")
|
||||
* monitor_synced — actual Tokenview registration state (default OFF: only set to true
|
||||
* when syncMonitor() / addAddress() succeeds)
|
||||
*
|
||||
* The sync-monitors scheduled command only retries addresses where
|
||||
* monitor=1 AND monitor_synced=0.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('wallet_addresses', function (Blueprint $table) {
|
||||
$table->boolean('monitor_synced')->default(false)->after('monitor');
|
||||
});
|
||||
|
||||
// Existing monitor=1 addresses are not yet synced with Tokenview.
|
||||
DB::table('wallet_addresses')->where('monitor', 1)->update(['monitor_synced' => false]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('wallet_addresses', function (Blueprint $table) {
|
||||
$table->dropColumn('monitor_synced');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Track consecutive Tokenview sync failures per address.
|
||||
* The sync-monitors scheduled task stops retrying an address once
|
||||
* monitor_failures >= 3 (until the user toggles the switch off/on again,
|
||||
* which resets the counter).
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('wallet_addresses', function (Blueprint $table) {
|
||||
$table->unsignedSmallInteger('monitor_failures')->default(0)->after('monitor_synced');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('wallet_addresses', function (Blueprint $table) {
|
||||
$table->dropColumn('monitor_failures');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user