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:
@@ -23,20 +23,20 @@ class Migrate_Begin_Command extends Command
|
||||
$flag_data = json_decode(file_get_contents($this->flag_file), true);
|
||||
$started_at = $flag_data['started_at'] ?? 'unknown time';
|
||||
|
||||
$this->info('✅ Migration session already active!');
|
||||
$this->info('[OK] Migration session already active!');
|
||||
$this->info('');
|
||||
$this->line('📝 Session started at: ' . $started_at);
|
||||
$this->line('📦 Snapshot available at: ' . $this->backup_dir);
|
||||
$this->line(' Session started at: ' . $started_at);
|
||||
$this->line(' Snapshot available at: ' . $this->backup_dir);
|
||||
$this->info('');
|
||||
$this->line('You are currently in migration mode with an active snapshot.');
|
||||
$this->line('There is no need to create another snapshot.');
|
||||
$this->info('');
|
||||
$this->line('Your options:');
|
||||
$this->info('');
|
||||
$this->line('1. 🚀 Continue creating/running migrations:');
|
||||
$this->line('1. Continue creating/running migrations:');
|
||||
$this->line(' php artisan migrate');
|
||||
$this->info('');
|
||||
$this->line('2. ✅ Keep all changes and exit migration mode:');
|
||||
$this->line('2. [OK] Keep all changes and exit migration mode:');
|
||||
$this->line(' php artisan migrate:commit');
|
||||
$this->line(' (After commit, run migrate:begin again for new atomic migrations)');
|
||||
$this->info('');
|
||||
@@ -44,13 +44,13 @@ class Migrate_Begin_Command extends Command
|
||||
$this->line(' php artisan migrate:rollback');
|
||||
$this->line(' (Database will be restored to state at ' . $started_at . ')');
|
||||
$this->info('');
|
||||
$this->warn('⚠️ The web UI remains disabled while in migration mode.');
|
||||
$this->warn('[WARNING] The web UI remains disabled while in migration mode.');
|
||||
return 0; // Return success since we're providing helpful information
|
||||
}
|
||||
|
||||
// Check if running in production
|
||||
if (app()->environment('production')) {
|
||||
$this->error('⚠️ This command is not available in production!');
|
||||
$this->error('[WARNING] This command is not available in production!');
|
||||
$this->info('Snapshot-based migrations are only for development environments.');
|
||||
$this->info('In production, run migrations directly with: php artisan migrate');
|
||||
return 1;
|
||||
@@ -58,12 +58,12 @@ class Migrate_Begin_Command extends Command
|
||||
|
||||
// Check if running in Docker environment
|
||||
if (!file_exists('/.dockerenv')) {
|
||||
$this->error('⚠️ This command requires Docker environment!');
|
||||
$this->error('[WARNING] This command requires Docker environment!');
|
||||
$this->info('Snapshot-based migrations are only available in Docker development environments.');
|
||||
return 1;
|
||||
}
|
||||
|
||||
$this->info('🔄 Starting migration snapshot process...');
|
||||
$this->info(' Starting migration snapshot process...');
|
||||
|
||||
try {
|
||||
// Step 1: Stop MySQL using supervisorctl
|
||||
@@ -101,51 +101,51 @@ class Migrate_Begin_Command extends Command
|
||||
|
||||
// Success message
|
||||
$this->info('');
|
||||
$this->info('✅ Database snapshot created successfully!');
|
||||
$this->info('[OK] Database snapshot created successfully!');
|
||||
$this->info('');
|
||||
$this->line('📋 Migration session is now active. You can:');
|
||||
$this->line(' Migration session is now active. You can:');
|
||||
$this->line(' • Run migrations: php artisan migrate');
|
||||
$this->line(' • Commit changes: php artisan migrate:commit');
|
||||
$this->line(' • Rollback changes: php artisan migrate:rollback');
|
||||
$this->info('');
|
||||
|
||||
// Migration best practices for LLMs
|
||||
$this->warn('⚠️ MIGRATION GUIDELINES FOR LLMs:');
|
||||
$this->warn('[WARNING] MIGRATION GUIDELINES FOR LLMs:');
|
||||
$this->line('');
|
||||
$this->line(' 🔹 Use RAW MySQL queries, not Laravel schema builder:');
|
||||
$this->line(' ✅ DB::statement("ALTER TABLE users ADD COLUMN age INT")');
|
||||
$this->line(' ❌ Schema::table("users", function($table) { $table->integer("age"); })');
|
||||
$this->line(' * Use RAW MySQL queries, not Laravel schema builder:');
|
||||
$this->line(' [OK] DB::statement("ALTER TABLE users ADD COLUMN age INT")');
|
||||
$this->line(' [ERROR] Schema::table("users", function($table) { $table->integer("age"); })');
|
||||
$this->line('');
|
||||
$this->line(' 🔹 ALL tables MUST have BIGINT ID primary key:');
|
||||
$this->line(' ✅ id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY');
|
||||
$this->line(' ❌ No exceptions - every table needs this exact ID column (SIGNED for easier migrations)');
|
||||
$this->line(' * ALL tables MUST have BIGINT ID primary key:');
|
||||
$this->line(' [OK] id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY');
|
||||
$this->line(' [ERROR] No exceptions - every table needs this exact ID column (SIGNED for easier migrations)');
|
||||
$this->line('');
|
||||
$this->line(' 🔹 Integer column types:');
|
||||
$this->line(' ✅ BIGINT for all integers (IDs, counts, foreign keys, etc.)');
|
||||
$this->line(' ✅ TINYINT(1) for boolean values (true/false only)');
|
||||
$this->line(' ❌ NEVER use unsigned - always use signed integers');
|
||||
$this->line(' ❌ NEVER use INT - always use BIGINT for consistency');
|
||||
$this->line(' * Integer column types:');
|
||||
$this->line(' [OK] BIGINT for all integers (IDs, counts, foreign keys, etc.)');
|
||||
$this->line(' [OK] TINYINT(1) for boolean values (true/false only)');
|
||||
$this->line(' [ERROR] NEVER use unsigned - always use signed integers');
|
||||
$this->line(' [ERROR] NEVER use INT - always use BIGINT for consistency');
|
||||
$this->line('');
|
||||
$this->line(' 🔹 Migrations must be SELF-CONTAINED:');
|
||||
$this->line(' * Migrations must be SELF-CONTAINED:');
|
||||
$this->line(' • Use direct table names, not Model references');
|
||||
$this->line(' • Use raw DB queries, not ORM/QueryBuilder');
|
||||
$this->line(' • Never import Models or Services');
|
||||
$this->line('');
|
||||
$this->line(' 🔹 Examples of GOOD migration code:');
|
||||
$this->line(' * Examples of GOOD migration code:');
|
||||
$this->line(' DB::statement("CREATE TABLE posts (');
|
||||
$this->line(' id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,');
|
||||
$this->line(' title VARCHAR(255)');
|
||||
$this->line(' )")');
|
||||
$this->line(' DB::statement("UPDATE users SET status = \'active\' WHERE created_at < NOW()")');
|
||||
$this->line('');
|
||||
$this->line(' 🔹 Target: MySQL only (no need for database abstraction)');
|
||||
$this->line(' * Target: MySQL only (no need for database abstraction)');
|
||||
$this->info('');
|
||||
$this->warn('⚠️ The web UI is disabled during migration mode.');
|
||||
$this->warn('[WARNING] The web UI is disabled during migration mode.');
|
||||
|
||||
return 0;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->error('❌ Failed to create snapshot: ' . $e->getMessage());
|
||||
$this->error('[ERROR] Failed to create snapshot: ' . $e->getMessage());
|
||||
|
||||
// Try to restart MySQL if it's stopped
|
||||
$this->info('Attempting to restart MySQL...');
|
||||
|
||||
Reference in New Issue
Block a user