Created
February 5, 2016 02:51
-
-
Save catatsuy/16771229e2d7727988e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| for (<>) { | |
| if (/\ACREATE TABLE ([`a-zA-Z0-9_]+)/) { | |
| print "\nALTER TABLE " . $1 . "\n"; | |
| } elsif (/\A[ ]+([`a-zA-Z0-9_]+) (varchar\(\d+\)|mediumtext|text)(( NOT NULL,)?)/) { | |
| if ($3) { | |
| print " MODIFY " . $1 . " " . $2 . " CHARACTER SET utf8mb4 NOT NULL,\n"; | |
| } else { | |
| print " MODIFY " . $1 . " " . $2 . " CHARACTER SET utf8mb4,\n"; | |
| } | |
| } elsif (/\A\) ENGINE=InnoDB/) { | |
| print "DEFAULT CHARACTER SET utf8mb4 ENGINE=Innodb;\n"; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://twitter.com/kamipo/status/704990880424329216