Convert all tables in database to utf8mb4. Fix #928

This commit is contained in:
joker-x 2020-08-26 06:54:18 +02:00
parent 90fb72fc6f
commit fcae585417
3 changed files with 24 additions and 6 deletions

View file

@ -0,0 +1,17 @@
exports.up = function(knex, Promise) {
return knex.raw('SELECT table_name FROM information_schema.tables WHERE table_schema = ?', [knex.client.database()])
.then(function(tablas) {
let sql="";
tablas=tablas[0];
for(let i=0; i<tablas.length; i++) {
sql+="ALTER TABLE "+tablas[i].table_name+" CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;";
}
//console.log(sql);
return knex.raw(sql);
});
};
exports.down = function(knex, Promise) {
};