mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Update role stacking
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?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::table('users', function (Blueprint $table) {
|
||||
$table->datetime('pending_role_start_date')->nullable()->after('rolechangedate')->comment('When the pending role change takes effect');
|
||||
$table->integer('pending_roles_id')->nullable()->after('pending_role_start_date')->comment('The role that will be applied after current role expires');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['pending_role_start_date', 'pending_roles_id']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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('user_role_history', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id')->index();
|
||||
$table->integer('old_role_id')->nullable();
|
||||
$table->integer('new_role_id');
|
||||
$table->datetime('old_expiry_date')->nullable()->comment('Previous role expiry date');
|
||||
$table->datetime('new_expiry_date')->nullable()->comment('New role expiry date');
|
||||
$table->datetime('effective_date')->comment('When this role change became active');
|
||||
$table->boolean('is_stacked')->default(false)->comment('Was this role stacked after previous expiry');
|
||||
$table->string('change_reason')->nullable()->comment('Reason for role change (upgrade, downgrade, expiry, admin, etc)');
|
||||
$table->unsignedBigInteger('changed_by')->nullable()->comment('Admin user ID who made the change');
|
||||
$table->timestamps();
|
||||
|
||||
// Note: Foreign key constraint removed due to potential schema conflicts
|
||||
// Ensure referential integrity at application level
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_role_history');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user