Replace emoji/Unicode characters with ASCII in migration commands
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -63,7 +63,7 @@ class Maint_Migrate extends Command
|
||||
// Check for migration mode if we require snapshot
|
||||
if ($require_snapshot) {
|
||||
if (!file_exists($this->flag_file)) {
|
||||
$this->error('❌ Migration mode not active!');
|
||||
$this->error('[ERROR] Migration mode not active!');
|
||||
$this->error('');
|
||||
$this->line('In development mode, you must create a database snapshot before running migrations.');
|
||||
$this->line('This prevents partial migrations from corrupting your database.');
|
||||
@@ -74,12 +74,12 @@ class Maint_Migrate extends Command
|
||||
return 1;
|
||||
}
|
||||
|
||||
$this->info('✅ Migration mode active - snapshot available for rollback');
|
||||
$this->info('[OK] Migration mode active - snapshot available for rollback');
|
||||
$this->info('');
|
||||
} elseif ($is_production) {
|
||||
$this->info('🚀 Running in production mode (no snapshot protection)');
|
||||
$this->info(' Running in production mode (no snapshot protection)');
|
||||
} elseif ($is_framework_only) {
|
||||
$this->info('🔧 Running framework-only migrations (no snapshot protection)');
|
||||
$this->info(' Running framework-only migrations (no snapshot protection)');
|
||||
}
|
||||
|
||||
$mode_desc = $is_production ? ' (production mode)' : ($is_framework_only ? ' (framework-only)' : ' with maintenance commands');
|
||||
@@ -93,7 +93,7 @@ class Maint_Migrate extends Command
|
||||
|
||||
// Check if path option is used and throw exception
|
||||
if (!empty($paths)) {
|
||||
$this->error('❌ Migration by path is disabled!');
|
||||
$this->error('[ERROR] Migration by path is disabled!');
|
||||
$this->error('');
|
||||
$this->line('This command enforces running all pending migrations in order.');
|
||||
$this->line('Please run migrations without the --path option:');
|
||||
@@ -136,7 +136,7 @@ class Maint_Migrate extends Command
|
||||
// Pass --production flag to skip snapshot in both production and framework-only modes
|
||||
$requiredColumnsArgs = ($is_production || $is_framework_only) ? ['--production' => true] : [];
|
||||
|
||||
$this->info("\n🔧 Pre-migration normalization (fixing existing tables)...\n");
|
||||
$this->info("\n Pre-migration normalization (fixing existing tables)...\n");
|
||||
$normalizeExitCode = $this->call('migrate:normalize_schema', $requiredColumnsArgs);
|
||||
if ($normalizeExitCode !== 0) {
|
||||
$this->error('Pre-migration normalization failed');
|
||||
@@ -191,13 +191,13 @@ class Maint_Migrate extends Command
|
||||
}
|
||||
|
||||
$this->error('');
|
||||
$this->error('❌ Migration failed!');
|
||||
$this->error('[ERROR] Migration failed!');
|
||||
$this->error('Error: ' . $e->getMessage());
|
||||
|
||||
// If in development mode with snapshot, automatically rollback
|
||||
if ($require_snapshot && file_exists($this->flag_file)) {
|
||||
$this->error('');
|
||||
$this->warn('🔄 Automatically rolling back to snapshot due to migration failure...');
|
||||
$this->warn(' Automatically rolling back to snapshot due to migration failure...');
|
||||
$this->info('');
|
||||
|
||||
// Call rollback command with output
|
||||
@@ -205,17 +205,17 @@ class Maint_Migrate extends Command
|
||||
|
||||
if ($rollback_result === 0) {
|
||||
$this->info('');
|
||||
$this->info('✅ Database rolled back successfully!');
|
||||
$this->info('[OK] Database rolled back successfully!');
|
||||
$this->info('');
|
||||
$this->warn('⚠️ You are still in migration mode.');
|
||||
$this->warn('[WARNING] You are still in migration mode.');
|
||||
$this->line('Your options:');
|
||||
$this->line(' 1. Fix your migration files');
|
||||
$this->line(' 2. Run "php artisan migrate" to try again');
|
||||
$this->line(' 3. Run "php artisan migrate:commit" to exit migration mode');
|
||||
} else {
|
||||
$this->error('❌ Automatic rollback failed!');
|
||||
$this->error('[ERROR] Automatic rollback failed!');
|
||||
$this->error('Run "php artisan migrate:rollback" manually.');
|
||||
$this->warn('⚠️ The database may be in an inconsistent state!');
|
||||
$this->warn('[WARNING] The database may be in an inconsistent state!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ class Maint_Migrate extends Command
|
||||
}
|
||||
|
||||
// Run normalize_schema AFTER migrations to add framework columns to new tables
|
||||
$this->info("\n🔧 Post-migration normalization (adding framework columns to new tables)...\n");
|
||||
$this->info("\n Post-migration normalization (adding framework columns to new tables)...\n");
|
||||
|
||||
// Switch to destructive-only query logging for normalize_schema
|
||||
AppServiceProvider::set_query_log_mode(AppServiceProvider::QUERY_LOG_DESTRUCTIVE_STDOUT);
|
||||
@@ -328,7 +328,7 @@ class Maint_Migrate extends Command
|
||||
|
||||
// If no whitelist exists yet, create one with existing migrations
|
||||
if (!$foundAtLeastOne) {
|
||||
$this->warn('⚠️ No migration whitelist found. Creating one with existing migrations...');
|
||||
$this->warn('[WARNING] No migration whitelist found. Creating one with existing migrations...');
|
||||
$this->createInitialWhitelist();
|
||||
return true;
|
||||
}
|
||||
@@ -347,14 +347,14 @@ class Maint_Migrate extends Command
|
||||
$unauthorizedMigrations = array_diff($migrationFiles, $whitelistedMigrations);
|
||||
|
||||
if (!empty($unauthorizedMigrations)) {
|
||||
$this->error('❌ Unauthorized migrations detected!');
|
||||
$this->error('[ERROR] Unauthorized migrations detected!');
|
||||
$this->error('');
|
||||
$this->line('The following migrations were not created via php artisan make:migration:');
|
||||
foreach ($unauthorizedMigrations as $migration) {
|
||||
$this->line(' • ' . $migration);
|
||||
}
|
||||
$this->error('');
|
||||
$this->warn('⚠️ Manually created migrations can cause timestamp conflicts and ordering issues.');
|
||||
$this->warn('[WARNING] Manually created migrations can cause timestamp conflicts and ordering issues.');
|
||||
$this->error('');
|
||||
$this->line('To fix this:');
|
||||
$this->line('1. Create a new migration using: php artisan make:migration [name]');
|
||||
@@ -411,12 +411,12 @@ class Maint_Migrate extends Command
|
||||
$count = count($whitelist['migrations']);
|
||||
$totalMigrations += $count;
|
||||
$location = str_replace(base_path() . '/', '', dirname($whitelistPath));
|
||||
$this->info("✅ Created whitelist in {$location} with {$count} migration(s).");
|
||||
$this->info("[OK] Created whitelist in {$location} with {$count} migration(s).");
|
||||
}
|
||||
}
|
||||
|
||||
if ($totalMigrations === 0) {
|
||||
$this->info('✅ No existing migrations found. Empty whitelists created.');
|
||||
$this->info('[OK] No existing migrations found. Empty whitelists created.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,9 +429,9 @@ class Maint_Migrate extends Command
|
||||
|
||||
// Only show concise output if successful
|
||||
if ($exitCode === 0) {
|
||||
$this->info("✓ Command $command completed successfully.");
|
||||
$this->info("[OK] Command $command completed successfully.");
|
||||
} else {
|
||||
$this->error("✗ Command $command failed with exit code $exitCode");
|
||||
$this->error("[FAIL] Command $command failed with exit code $exitCode");
|
||||
$this->output->write($commandOutput);
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ class Maint_Migrate extends Command
|
||||
try {
|
||||
// Validate the migration file for Schema builder usage
|
||||
MigrationValidator::validate_migration_file($migration_path);
|
||||
$this->info(" ✓ " . basename($migration_path));
|
||||
$this->info(" [OK] " . basename($migration_path));
|
||||
} catch (\RuntimeException $e) {
|
||||
// MigrationValidator already printed colored error output
|
||||
$has_violations = true;
|
||||
@@ -488,7 +488,7 @@ class Maint_Migrate extends Command
|
||||
// If we processed any migrations (removed down methods), notify user
|
||||
if (!empty($processed_migrations)) {
|
||||
$this->info('');
|
||||
$this->warn('⚠️ Modified migration files:');
|
||||
$this->warn('[WARNING] Modified migration files:');
|
||||
foreach ($processed_migrations as $path) {
|
||||
$this->line(' • ' . basename($path) . ' - down() method removed');
|
||||
}
|
||||
@@ -520,7 +520,7 @@ class Maint_Migrate extends Command
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
");
|
||||
|
||||
$this->info('✓ Migrations table created');
|
||||
$this->info('[OK] Migrations table created');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ class Maint_Migrate extends Command
|
||||
|
||||
// Run normalization after this migration (if not the last)
|
||||
if ($currentMigration < $totalMigrations) {
|
||||
$this->info("\n🔧 Normalizing schema after migration...\n");
|
||||
$this->info("\n Normalizing schema after migration...\n");
|
||||
|
||||
// Switch to destructive-only query logging
|
||||
AppServiceProvider::set_query_log_mode(AppServiceProvider::QUERY_LOG_DESTRUCTIVE_STDOUT);
|
||||
@@ -610,6 +610,6 @@ class Maint_Migrate extends Command
|
||||
}
|
||||
|
||||
$this->newLine();
|
||||
$this->info("✅ All $totalMigrations migration" . ($totalMigrations > 1 ? 's' : '') . " completed successfully");
|
||||
$this->info("[OK] All $totalMigrations migration" . ($totalMigrations > 1 ? 's' : '') . " completed successfully");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user