不要怂,就是干,撸起袖子干!

Commit d1645f23 by Tony Brix Committed by Sushant

fix(mssql): describeTable for VARCHAR(MAX) (#10795)

1 parent c44c72ae
...@@ -176,8 +176,12 @@ class Query extends AbstractQuery { ...@@ -176,8 +176,12 @@ class Query extends AbstractQuery {
result[_result.Name].type.includes('VARCHAR') result[_result.Name].type.includes('VARCHAR')
&& _result.Length && _result.Length
) { ) {
if (_result.Length === -1) {
result[_result.Name].type += '(MAX)';
} else {
result[_result.Name].type += `(${_result.Length})`; result[_result.Name].type += `(${_result.Length})`;
} }
}
} }
} }
......
...@@ -82,4 +82,17 @@ if (dialect.match(/^mssql/)) { ...@@ -82,4 +82,17 @@ if (dialect.match(/^mssql/)) {
}); });
}); });
}); });
it('sets the varchar(max) length correctly on describeTable', function() {
const Users = this.sequelize.define('_Users', {
username: Sequelize.STRING('MAX')
}, { freezeTableName: true });
return Users.sync({ force: true }).then(() => {
return this.sequelize.getQueryInterface().describeTable('_Users').then(metadata => {
const username = metadata.username;
expect(username.type).to.include('(MAX)');
});
});
});
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!