Testing Alpha

This commit is contained in:
2025-05-11 14:14:50 -06:00
parent 988b86a33d
commit a7002701f5
1903 changed files with 77534 additions and 36485 deletions

View File

@ -27,49 +27,69 @@ return new class extends Migration
Schema::create($tableNames['permissions'], function (Blueprint $table) {
//$table->engine('InnoDB');
$table->bigIncrements('id'); // permission id
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->string('group_name')->nullable()->index();
$table->string('sub_group_name')->nullable()->index();
$table->string('action')->nullable()->index();
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->smallIncrements('id');
// Permiso Spatie
$table->string('name')->unique(); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
// Metadata
$table->unsignedSmallInteger('group_id')->nullable()->index();
$table->json('label')->nullable(); // Nombre del permiso i18n
$table->json('ui_metadata')->nullable(); // helperText, floatLabel
// Acción
$table->string('action', 16)->nullable()->index(); // enum PermissionAction: view, create, update, delete, install, clean
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
// Auditoría
$table->timestamps();
$table->unique(['name', 'guard_name']);
$table->unique(['group_name', 'sub_group_name', 'action', 'guard_name']);
// Relaciones
$table->foreign('group_id')
->references('id')
->on('permission_groups')
->restrictOnDelete()
->cascadeOnUpdate();
});
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
//$table->engine('InnoDB');
$table->bigIncrements('id'); // role id
$table->smallIncrements('id'); // role id
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->unsignedSmallInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
}
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->string('style')->nullable();
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->json('ui_metadata')->nullable(); // Tailwind classes, icon, helperText, floatLabel
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
// Auditoría
$table->timestamps();
if ($teams || config('permission.testing')) {
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
} else {
$table->unique(['name', 'guard_name']);
}
});
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
$table->unsignedBigInteger($pivotPermission);
$table->unsignedSmallInteger($pivotPermission);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->unsignedSmallInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
$table->foreign($pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->unsignedSmallInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
$table->primary(
@ -85,18 +105,19 @@ return new class extends Migration
});
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
$table->unsignedBigInteger($pivotRole);
$table->unsignedSmallInteger($pivotRole);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->unsignedSmallInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
$table->foreign($pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->unsignedSmallInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
$table->primary(
@ -112,8 +133,8 @@ return new class extends Migration
});
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
$table->unsignedBigInteger($pivotPermission);
$table->unsignedBigInteger($pivotRole);
$table->unsignedSmallInteger($pivotPermission);
$table->unsignedSmallInteger($pivotRole);
$table->foreign($pivotPermission)
->references('id') // permission id