51 lines
1.9 KiB
PHP
Executable File
51 lines
1.9 KiB
PHP
Executable File
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('modules', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('name')->unique()->index();
|
|
$table->string('display_name');
|
|
$table->string('description')->nullable();
|
|
$table->string('version');
|
|
$table->string('author')->nullable();
|
|
$table->enum('status', ['active', 'inactive', 'installing', 'updating', 'error'])->default('inactive');
|
|
$table->enum('license', ['free', 'commercial', 'custom'])->default('free');
|
|
$table->decimal('price', 10, 2)->nullable();
|
|
$table->string('currency', 3)->default('EUR');
|
|
$table->enum('billing', ['one-time', 'monthly', 'yearly'])->default('yearly');
|
|
$table->json('config'); // Configurazione completa del modulo
|
|
$table->json('dependencies')->nullable(); // Lista dipendenze
|
|
$table->json('permissions')->nullable(); // Permessi del modulo
|
|
$table->string('license_key')->nullable(); // Chiave licenza
|
|
$table->timestamp('license_expires_at')->nullable(); // Scadenza licenza
|
|
$table->timestamp('installed_at')->nullable();
|
|
$table->timestamp('last_updated')->nullable();
|
|
$table->string('installed_by')->nullable(); // User che ha installato
|
|
$table->text('install_log')->nullable(); // Log installazione
|
|
$table->timestamps();
|
|
|
|
// Indici per performance
|
|
$table->index(['status', 'name']);
|
|
$table->index('license');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('modules');
|
|
}
|
|
};
|