Files
2026-09-01 10:46:29 -03:00

58 lines
2.6 KiB
PHP
Executable File

<?php
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Database\Schema\Blueprint;
class CreateSystemConfigTables
{
public function up()
{
// System Config
if (!Capsule::schema()->hasTable('system_config')) {
Capsule::schema()->create('system_config', function (Blueprint $table) {
$table->increments('system_config_id');
$table->string('system_config_key')->unique();
$table->text('system_config_value')->nullable();
$table->string('system_config_type')->default('string'); // string, boolean, integer, json
$table->text('system_config_description')->nullable();
$table->boolean('system_config_is_public')->default(false);
$table->integer('system_config_updated_by')->unsigned()->nullable();
$table->timestamps();
});
}
// Modules Table (Core table, placed here for system initialization)
if (!Capsule::schema()->hasTable('modules')) {
Capsule::schema()->create('modules', function (Blueprint $table) {
$table->increments('modules_id');
$table->string('modules_name')->unique(); // Folder name
$table->string('modules_display_name')->nullable();
$table->text('modules_description')->nullable();
$table->string('modules_version')->default('1.0.0');
$table->string('modules_author')->nullable();
$table->boolean('modules_ative')->default(false);
$table->boolean('modules_public')->default(false);
$table->boolean('modules_blocked')->default(false);
$table->json('modules_dependencies')->nullable();
$table->json('modules_permissions')->nullable();
$table->json('modules_settings')->nullable();
$table->string('modules_path')->nullable();
$table->string('modules_namespace')->nullable();
$table->string('modules_icon')->nullable();
$table->boolean('menu_side_bar')->default(false);
$table->boolean('menu_nav_bar')->default(false);
$table->integer('modules_order')->default(0);
$table->timestamp('modules_install_date')->nullable();
$table->timestamp('modules_update_date')->nullable();
$table->timestamps();
});
}
}
public function down()
{
Capsule::schema()->dropIfExists('modules');
Capsule::schema()->dropIfExists('system_config');
}
}