MySQL 修改int类型为bigint SQL语句拼接
SELECT
CONCAT(
"alter table ",
TABLE_SCHEMA,
".",
TABLE_NAME,
" modify ",
COLUMN_NAME,
" bigint(20)",
IF
( IS_NULLABLE = 'NO', " NOT NULL", "" ),
IF
( EXTRA = "", "", " AUTO_INCREMENT" ),
IF
( COLUMN_DEFAULT IS NULL, "", CONCAT( " DEFAULT ", COLUMN_DEFAULT ) ),
IF
( COLUMN_COMMENT = "", "", CONCAT( " COMMENT '", COLUMN_COMMENT, "'" ) ),
";"
) AS alter_sql
FROM
information_schema.COLUMNS
WHERE
( COLUMN_NAME = 'orderid' OR COLUMN_NAME = 'order_id' )
AND DATA_TYPE = 'int';