This commit is contained in:
Iván Eixarch 2020-09-16 16:50:21 +02:00 committed by GitHub
commit d83903ea82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 10 deletions

View file

@ -1,6 +1,10 @@
'use strict';
const config = require('./config');
let config = require('./config');
config.mysql.charset="utf8mb4";
config.mysql.multipleStatements=true;
module.exports = {
client: 'mysql',

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) {
};