diff --git a/lib/objects/table/change-rules.js b/lib/objects/table/change-rules.js index 743c2ec..005b362 100644 --- a/lib/objects/table/change-rules.js +++ b/lib/objects/table/change-rules.js @@ -90,6 +90,10 @@ exports.isColumnModificationAllowed = (prev, next) => { return true; } + case validate(Types.json, [Types.jsonb]): { + return true; + } + default: return false; } diff --git a/lib/types.js b/lib/types.js index 3a73719..36557c3 100644 --- a/lib/types.js +++ b/lib/types.js @@ -24,6 +24,8 @@ const DataTypes = { timeTZ: 'time with time zone', timeStamp: 'timestamp without time zone', timeStampTZ: 'timestamp with time zone', + json: 'json', + jsonb: 'jsonb', }; const _placeholders = { diff --git a/test/synchronization/column/type.test.js b/test/synchronization/column/type.test.js index a041c53..2a7563a 100644 --- a/test/synchronization/column/type.test.js +++ b/test/synchronization/column/type.test.js @@ -73,6 +73,10 @@ describe('column.type', () => { to: ['numeric(24)[][]'], forbidden: true, }, + { + from: 'json', + to: ['jsonb'], + }, ].forEach(({ from: prevType, to: types, forbidden }) => { const table = 'DifferSchema.users'; const column = 'birthday';