MySQL -> Go UUID

Simple UUID wrapper for MySQL in Go that covers UUID to BIN conversion

Here’s a quick snippet you can use to create a custom type that maps an UUID to a Binary(16) representation in MySQL. I assume this is not present in gofrs/uuid since it’s database specific, but having NullUUID available is an easy ‘inspiration’ opportunity ;). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 import ( "database/sql/driver" "github....

20 August, 2023 · 1 min · 167 words · Alexandru Bucur

Mysql Alter Table Select all Tables

In case you wanted for example to change all your MyISAM tables into InnoDB , and you didn’t want to go over the tables one by one, you can do the following queries. First check that you’re doing it on the proper database. 1 2 3 4 USE information_schema; SELECT TABLE_SCHEMA, TABLE_NAME FROM TABLES WHERE TABLE_SCHEMA = "your_db_name"; If it returns what you need you can then run: 1 2 3 SELECT CONCAT("ALTER TABLE `", TABLE_SCHEMA,"`....

07 March, 2012 · 1 min · 90 words · Alexandru Bucur