Prune the upstream Mini/QR mobile subsystem from POS
Deploy Ladill POS / deploy (push) Successful in 33s
Deploy Ladill POS / deploy (push) Successful in 33s
POS was forked from Ladill Mini and carried Mini's entire mobile/QR subsystem (API, QR codes, wallet, payments, push, Afia) which polluted the ladill_pos schema with 8 unused tables and left ~half the test suite red. Remove the dead subsystem: Api/Mini/Qr/Public/Search/WellKnown controllers, Mini/Qr/Afia/Notifications services, the 8 unused models, QrCodePolicy, Support/Qr + Support/Events, the two mini: scheduled commands, the Mini/QR view trees, and their (failing) tests. Empty routes/api.php (POS is web-only) and strip dead schedules from routes/console.php. Keep QrTeamMember — it is the platform team-membership model that POS's SetActingAccount middleware and SSO login depend on for multi-account access. Also keep notifications + personal_access_tokens (used by POS). Drops 7 migrations (qr product/settings, mini_payments, push tokens); the 8 orphan tables are dropped from the live ladill_pos DB separately. Test suite is green (8 passed) and all routes resolve. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
57862acb47
commit
46b5091b1e
@@ -1,101 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('qr_wallets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
|
||||
$table->decimal('credit_balance', 10, 4)->default(0);
|
||||
$table->unsignedInteger('qr_codes_total')->default(0);
|
||||
$table->unsignedBigInteger('scans_total')->default(0);
|
||||
$table->string('status', 20)->default('active');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('qr_documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('disk', 32)->default('qr');
|
||||
$table->string('path');
|
||||
$table->string('mime_type', 128)->default('application/pdf');
|
||||
$table->unsignedBigInteger('size_bytes')->default(0);
|
||||
$table->unsignedSmallInteger('page_count')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'created_at']);
|
||||
});
|
||||
|
||||
Schema::create('qr_codes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('short_code', 16)->unique();
|
||||
$table->string('type', 32);
|
||||
$table->string('label');
|
||||
$table->text('destination_url')->nullable();
|
||||
$table->foreignId('qr_document_id')->nullable()->constrained('qr_documents')->nullOnDelete();
|
||||
$table->json('payload')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->string('png_path')->nullable();
|
||||
$table->string('svg_path')->nullable();
|
||||
$table->unsignedBigInteger('scans_total')->default(0);
|
||||
$table->unsignedBigInteger('unique_scans_total')->default(0);
|
||||
$table->timestamp('last_scanned_at')->nullable();
|
||||
$table->timestamp('destination_updated_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'created_at']);
|
||||
$table->index(['user_id', 'is_active']);
|
||||
});
|
||||
|
||||
Schema::create('qr_transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('qr_wallet_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('qr_code_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('type', 16);
|
||||
$table->decimal('amount_ghs', 10, 4);
|
||||
$table->decimal('balance_after_ghs', 10, 4);
|
||||
$table->string('reference')->nullable()->index();
|
||||
$table->string('status', 20)->default('completed');
|
||||
$table->string('description')->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['qr_wallet_id', 'created_at']);
|
||||
});
|
||||
|
||||
Schema::create('qr_scan_events', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('qr_code_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamp('scanned_at');
|
||||
$table->string('ip_hash', 64)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->string('device_type', 32)->nullable();
|
||||
$table->string('browser', 64)->nullable();
|
||||
$table->string('os', 64)->nullable();
|
||||
$table->string('country_code', 8)->nullable();
|
||||
$table->string('referrer')->nullable();
|
||||
$table->boolean('is_unique')->default(false);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['qr_code_id', 'scanned_at']);
|
||||
$table->index(['qr_code_id', 'ip_hash']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('qr_scan_events');
|
||||
Schema::dropIfExists('qr_transactions');
|
||||
Schema::dropIfExists('qr_codes');
|
||||
Schema::dropIfExists('qr_documents');
|
||||
Schema::dropIfExists('qr_wallets');
|
||||
}
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('qr_codes', function (Blueprint $table) {
|
||||
$table->string('short_code', 32)->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('qr_codes', function (Blueprint $table) {
|
||||
$table->string('short_code', 16)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('qr_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
|
||||
$table->string('notify_email')->nullable();
|
||||
$table->boolean('product_updates')->default(true);
|
||||
$table->boolean('low_balance_alerts')->default(true);
|
||||
$table->string('default_type', 32)->nullable();
|
||||
$table->json('default_style')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('qr_settings');
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('mini_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('qr_code_id')->constrained('qr_codes')->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('reference', 32)->unique();
|
||||
$table->unsignedInteger('amount_minor');
|
||||
$table->string('currency', 3)->default('GHS');
|
||||
$table->unsignedInteger('platform_fee_minor')->default(0);
|
||||
$table->unsignedInteger('merchant_amount_minor')->default(0);
|
||||
$table->string('payer_name')->nullable();
|
||||
$table->string('payer_email')->nullable();
|
||||
$table->string('payer_phone', 32)->nullable();
|
||||
$table->string('payer_note')->nullable();
|
||||
$table->string('status', 16)->default('pending');
|
||||
$table->string('payment_reference', 64)->nullable()->unique();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'status', 'paid_at']);
|
||||
$table->index(['qr_code_id', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mini_payments');
|
||||
}
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('mini_payments', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('pay_order_id')->nullable()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mini_payments', function (Blueprint $table) {
|
||||
$table->dropColumn('pay_order_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_push_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('token', 512)->unique();
|
||||
$table->string('platform', 32)->default('android');
|
||||
$table->string('device_name')->nullable();
|
||||
$table->timestamp('last_seen_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'updated_at']);
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->timestamp('last_app_active_at')->nullable()->after('remember_token');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('last_app_active_at');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('user_push_tokens');
|
||||
}
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('qr_settings', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('auto_withdraw_amount_minor')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('qr_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('auto_withdraw_amount_minor');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user