{"modulePath":"github.com/CORESTOREIO/CSFW","version":"v0.0.0-20230101183712-202847b4b89b","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package migration\n\nPackage migration provides tools for database schema migrations.\n\nThe usual problems regarding downtime are not solved. Use vitess or the other tools.\n\n[https://github.com/golang-migrate/migrate](https://github.com/golang-migrate/migrate)\n\n## Functions\n\n```go\nfunc Run() error\n```\nRun 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.\n\n```go\nfunc ToUTF8MB4(ctx context.Context, db interface {\n\tdml.Querier\n\tdml.Execer\n\tdml.Preparer\n}) error\n```\nToUTF8MB4 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.\n\n\\# 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;\n\n\\# 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;\n\n\\# 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;\n\n","path":"github.com/CORESTOREIO/CSFW/sql/migration","name":"migration","synopsis":"Package migration provides tools for database schema migrations.","isRedistributable":true}
