feat: harden billing verification and add browse route parity
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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('licenses', function (Blueprint $table): void {
|
||||
$table->string('license_key', 191)->primary();
|
||||
$table->string('source', 32)->nullable();
|
||||
$table->string('plan', 32)->default('pro');
|
||||
$table->string('status', 32)->default('active');
|
||||
$table->string('product_id', 191)->nullable();
|
||||
$table->string('owner_user_id', 64)->nullable()->index();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamp('last_verified_at')->nullable();
|
||||
$table->json('meta_json')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['status', 'expires_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('licenses');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('license_activations', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('license_key', 191);
|
||||
$table->string('user_id', 64);
|
||||
$table->string('product', 32)->default('site');
|
||||
$table->string('device_id', 191)->nullable();
|
||||
$table->string('status', 32)->default('active');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['license_key', 'product', 'device_id'], 'uniq_license_product_device');
|
||||
$table->index(['license_key', 'product', 'status'], 'idx_license_product_status');
|
||||
$table->index(['user_id', 'status'], 'idx_user_status');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('license_activations');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('usage_logs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('bucket_id', 191);
|
||||
$table->date('date_key');
|
||||
$table->unsignedInteger('used')->default(0);
|
||||
$table->unsignedInteger('limit_count')->nullable();
|
||||
$table->json('seen_signatures')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['bucket_id', 'date_key'], 'uniq_bucket_day');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('usage_logs');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user