Documentation ¶
Overview ¶
Package migration provides tools for database schema migrations.
The usual problems regarding downtime are not solved. Use vitess or the other tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run() error
Run has the idea of gathering all eligible .sql files in the folder `_dbmigrate` and put them in a zip and execute that zip file with this program on the server. Alternatively this program reads the .sql files from the go-bindata archive so that you only need to deploy one runable file.
func ToUTF8MB4 ¶
ToUTF8MB4 converts MySQL compatible databases from utf8 to utf8mb4. What’s the difference between utf8 and utf8mb4? MySQL decided that UTF-8 can only hold 3 bytes per character. Why? No good reason can be found documented anywhere. Few years later, when MySQL 5.5.3 was released, they introduced a new encoding called utf8mb4, which is actually the real 4-byte utf8 encoding that you know and love.
# Run this once on each schema you have (Replace database_name with your schema name) ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# Run this once for each table you have (replace table_name with the table name) ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# Run this for each column (replace table name, column_name, the column type, maximum length, etc.) ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Types ¶
This section is empty.