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
|
||||
");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user