@@ -241,9 +241,32 @@ public function compileRename(Blueprint $blueprint, Fluent $command)
241
241
*/
242
242
public function compileRenameColumn (Blueprint $ blueprint , Fluent $ command , Connection $ connection )
243
243
{
244
- return sprintf ('alter table %s change %s %s ' ,
244
+ return sprintf (
245
+ 'alter table %s change %s %s ' ,
245
246
$ this ->wrapTable ($ blueprint ),
246
247
$ this ->wrap ($ command ->from ),
247
- $ this ->wrap ($ command ->to ));
248
+ $ this ->wrap ($ command ->to )
249
+ );
250
+ }
251
+
252
+ /**
253
+ * Compile the query to determine the columns.
254
+ *
255
+ * @param string $database
256
+ * @param string $table
257
+ * @return string
258
+ */
259
+ public function compileColumns ($ database , $ table )
260
+ {
261
+ return sprintf (
262
+ 'select column_name as `name`, data_type as `type_name`, column_type as `type`, '
263
+ .'collation_name as `collation`, is_nullable as `nullable`, '
264
+ .'column_default as `default`, column_comment as `comment`, '
265
+ .'"" as `expression`, extra as `extra` '
266
+ .'from information_schema.columns where table_schema = %s and table_name = %s '
267
+ .'order by ordinal_position asc ' ,
268
+ $ this ->quoteString ($ database ),
269
+ $ this ->quoteString ($ table )
270
+ );
248
271
}
249
272
}
0 commit comments