From a32b087d8d3fd1085316cb6523b167ca10fb19b0 Mon Sep 17 00:00:00 2001 From: Tom Lankhorst Date: Sun, 14 Jan 2018 15:50:27 +0100 Subject: [PATCH] [5.5] Fix abundant table-prefix in SQLite grammar (#22781) * Removed abundant wrapTable in compileColumnListing * Added assertions on column existence * Wrap $table * Applied StyleCI fix --- src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php | 2 +- tests/Database/DatabaseSQLiteSchemaGrammarTest.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index ac04a75f5c7c..27e372d5d6d8 100755 --- a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -41,7 +41,7 @@ public function compileTableExists() */ public function compileColumnListing($table) { - return 'pragma table_info('.$this->wrapTable(str_replace('.', '__', $table)).')'; + return 'pragma table_info('.$this->wrap(str_replace('.', '__', $table)).')'; } /** diff --git a/tests/Database/DatabaseSQLiteSchemaGrammarTest.php b/tests/Database/DatabaseSQLiteSchemaGrammarTest.php index 80ff68d4a9a8..626a3754b6c0 100755 --- a/tests/Database/DatabaseSQLiteSchemaGrammarTest.php +++ b/tests/Database/DatabaseSQLiteSchemaGrammarTest.php @@ -112,10 +112,13 @@ public function testDropColumn() }); $this->assertTrue($schema->hasTable('users')); + $this->assertTrue($schema->hasColumn('users', 'name')); $schema->table('users', function (Blueprint $table) { $table->dropColumn('name'); }); + + $this->assertFalse($schema->hasColumn('users', 'name')); } /**