@@ -126,7 +126,7 @@ public function readIndexes($tableName, $resource)
126
126
$ indexes = [];
127
127
$ adapter = $ this ->resourceConnection ->getConnection ($ resource );
128
128
$ condition = sprintf ('`Non_unique` = 1 ' );
129
- $ sql = sprintf ('SHOW INDEXES FROM %s WHERE %s ' , $ tableName , $ condition );
129
+ $ sql = sprintf ('SHOW INDEXES FROM `%s` WHERE %s ' , $ tableName , $ condition );
130
130
$ stmt = $ adapter ->query ($ sql );
131
131
132
132
// Use FETCH_NUM so we are not dependent on the CASE attribute of the PDO connection
@@ -147,9 +147,10 @@ public function readIndexes($tableName, $resource)
147
147
}
148
148
149
149
/**
150
+ * Read references (foreign keys) from Magento tables.
151
+ *
150
152
* As MySQL has bug and do not show foreign keys during DESCRIBE and other directives required
151
- * to take it from SHOW CREATE TABLE ...
152
- * command
153
+ * to take it from "SHOW CREATE TABLE ..." command.
153
154
*
154
155
* @inheritdoc
155
156
*/
@@ -170,13 +171,14 @@ public function readReferences($tableName, $resource)
170
171
public function getCreateTableSql ($ tableName , $ resource )
171
172
{
172
173
$ adapter = $ this ->resourceConnection ->getConnection ($ resource );
173
- $ sql = sprintf ('SHOW CREATE TABLE %s ' , $ tableName );
174
+ $ sql = sprintf ('SHOW CREATE TABLE `%s` ' , $ tableName );
174
175
$ stmt = $ adapter ->query ($ sql );
175
176
return $ stmt ->fetch (\Zend_Db::FETCH_ASSOC );
176
177
}
177
178
178
179
/**
179
180
* Reading DB constraints.
181
+ *
180
182
* Primary and unique constraints are always non_unique=0.
181
183
*
182
184
* @inheritdoc
@@ -186,7 +188,7 @@ public function readConstraints($tableName, $resource)
186
188
$ constraints = [];
187
189
$ adapter = $ this ->resourceConnection ->getConnection ($ resource );
188
190
$ condition = sprintf ('`Non_unique` = 0 ' );
189
- $ sql = sprintf ('SHOW INDEXES FROM %s WHERE %s ' , $ tableName , $ condition );
191
+ $ sql = sprintf ('SHOW INDEXES FROM `%s` WHERE %s ' , $ tableName , $ condition );
190
192
$ stmt = $ adapter ->query ($ sql );
191
193
192
194
// Use FETCH_NUM so we are not dependent on the CASE attribute of the PDO connection
0 commit comments