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

Commit 1cffab70 by Tony Brix Committed by Sushant

fix(describetable): support string length for char in mssql (#11212)

1 parent dc6249a6
...@@ -173,7 +173,7 @@ class Query extends AbstractQuery { ...@@ -173,7 +173,7 @@ class Query extends AbstractQuery {
}; };
if ( if (
result[_result.Name].type.includes('VARCHAR') result[_result.Name].type.includes('CHAR')
&& _result.Length && _result.Length
) { ) {
if (_result.Length === -1) { if (_result.Length === -1) {
......
...@@ -95,4 +95,17 @@ if (dialect.match(/^mssql/)) { ...@@ -95,4 +95,17 @@ if (dialect.match(/^mssql/)) {
}); });
}); });
}); });
it('sets the char(10) length correctly on describeTable', function() {
const Users = this.sequelize.define('_Users', {
username: Sequelize.CHAR(10)
}, { 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('(10)');
});
});
});
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!