Add 100+ automated unit tests from .expect file specifications Add session system test Add rsx:constants:regenerate command test Add rsx:logrotate command test Add rsx:clean command test Add rsx:manifest:stats command test Add model enum system test Add model mass assignment prevention test Add rsx:check command test Add migrate:status command test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
76 lines
2.1 KiB
PHP
76 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* CODING CONVENTION:
|
|
* This file follows the coding convention where variable_names and function_names
|
|
* use snake_case (underscore_wherever_possible).
|
|
*/
|
|
|
|
namespace App\RSpade\Commands\Migrate;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\DB;
|
|
use App\RSpade\Core\Database\MigrationPaths;
|
|
|
|
/**
|
|
* Show pending migrations that have not been run yet
|
|
*
|
|
* This command displays a simple list of migration files that are present
|
|
* in the migrations directory but have not yet been executed against the database.
|
|
*/
|
|
class Pending_Command extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'migrate:pending';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Show pending migrations that have not been run';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
// Get the migrator instance
|
|
$migrator = app('migrator');
|
|
|
|
// Get migration files from all migration directories
|
|
$migration_files = [];
|
|
foreach (MigrationPaths::get_all_paths() as $path) {
|
|
$migration_files = array_merge(
|
|
$migration_files,
|
|
$migrator->getMigrationFiles($path)
|
|
);
|
|
}
|
|
|
|
// Get migrations that have already been run
|
|
$ran_migrations = $migrator->getRepository()->getRan();
|
|
|
|
// Find pending migrations (files not in the ran list)
|
|
$pending_migrations = array_diff(array_keys($migration_files), $ran_migrations);
|
|
|
|
// Sort them to maintain chronological order
|
|
sort($pending_migrations);
|
|
|
|
if (empty($pending_migrations)) {
|
|
$this->info('No pending migrations.');
|
|
return 0;
|
|
}
|
|
|
|
$this->line('Migrations Pending:');
|
|
foreach ($pending_migrations as $migration) {
|
|
$this->line('- ' . $migration);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
} |