Fallback to JSON when using JSONB in MySQL (#3394)

fixes #3386
This commit is contained in:
Igor Savin 2019-08-14 17:11:01 +02:00 committed by GitHub
parent f264b1ae38
commit 2c3b4ded7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 13 deletions

View File

@ -113,6 +113,10 @@ Object.assign(ColumnCompiler_MySQL.prototype, {
return 'json';
},
jsonb() {
return 'json';
},
// Modifiers
// ------

View File

@ -66,19 +66,29 @@ module.exports = function(dialect) {
);
});
if (dialect !== 'maria') {
it('adding json', function() {
tableSql = client
.schemaBuilder()
.table('user', function(t) {
t.json('preferences');
})
.toSQL();
expect(tableSql[0].sql).to.equal(
'alter table `user` add `preferences` json'
);
});
}
it('adding json', function() {
tableSql = client
.schemaBuilder()
.table('user', function(t) {
t.json('preferences');
})
.toSQL();
expect(tableSql[0].sql).to.equal(
'alter table `user` add `preferences` json'
);
});
it('adding jsonb', function() {
tableSql = client
.schemaBuilder()
.table('user', function(t) {
t.jsonb('preferences');
})
.toSQL();
expect(tableSql[0].sql).to.equal(
'alter table `user` add `preferences` json'
);
});
it('test drop table', function() {
tableSql = client