Fix migration table naming and migrate:commit exit code
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -508,16 +508,18 @@ class Maint_Migrate extends Command
|
||||
{
|
||||
try {
|
||||
// Try to query the migrations table
|
||||
DB::select('SELECT 1 FROM migrations LIMIT 1');
|
||||
$table = config('database.migrations', 'migrations');
|
||||
DB::select("SELECT 1 FROM {$table} LIMIT 1");
|
||||
} catch (\Exception $e) {
|
||||
// Table doesn't exist, create it
|
||||
$table = config('database.migrations', 'migrations');
|
||||
$this->info('Creating migrations table...');
|
||||
|
||||
DB::statement("
|
||||
CREATE TABLE IF NOT EXISTS migrations (
|
||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||
migration VARCHAR(255) NOT NULL,
|
||||
batch INT NOT NULL
|
||||
CREATE TABLE IF NOT EXISTS {$table} (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
migration VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
batch BIGINT NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
");
|
||||
|
||||
|
||||
@@ -110,10 +110,10 @@ class Migrate_Commit_Command extends Command
|
||||
$this->info('Regenerating model constants...');
|
||||
$this->call('rsx:constants:regenerate');
|
||||
|
||||
// Recompile bundles
|
||||
// Recompile bundles (must use passthru for fresh process)
|
||||
$this->newLine();
|
||||
$this->info('Recompiling bundles...');
|
||||
$this->call('rsx:bundle:compile');
|
||||
passthru('php artisan rsx:bundle:compile');
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -154,7 +154,8 @@ class Migrate_Commit_Command extends Command
|
||||
}
|
||||
|
||||
// Get list of already run migrations from database
|
||||
$ran_migrations = DB::table('migrations')->pluck('migration')->toArray();
|
||||
$table = config('database.migrations', 'migrations');
|
||||
$ran_migrations = DB::table($table)->pluck('migration')->toArray();
|
||||
|
||||
// Check each file
|
||||
foreach ($files as $file) {
|
||||
|
||||
Reference in New Issue
Block a user