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

Commit 321394b4 by Gabe Gorelick Committed by Sushant

fix(abstract/querygenerator): correctly name indexes that live in custom schemas (#8151)

1 parent f25a59de
...@@ -425,6 +425,11 @@ const QueryGenerator = { ...@@ -425,6 +425,11 @@ const QueryGenerator = {
}, },
nameIndexes(indexes, rawTablename) { nameIndexes(indexes, rawTablename) {
if (typeof rawTablename === 'object') {
// don't include schema in the index name
rawTablename = rawTablename.tableName;
}
return _.map(indexes, index => { return _.map(indexes, index => {
if (!index.hasOwnProperty('name')) { if (!index.hasOwnProperty('name')) {
const onlyAttributeNames = index.fields.map(field => typeof field === 'string' ? field : field.name || field.attribute); const onlyAttributeNames = index.fields.map(field => typeof field === 'string' ? field : field.name || field.attribute);
......
...@@ -138,6 +138,8 @@ describe(Support.getTestDialectTeaser('QueryInterface'), () => { ...@@ -138,6 +138,8 @@ describe(Support.getTestDialectTeaser('QueryInterface'), () => {
tableName: 'table' tableName: 'table'
}).then(indexes => { }).then(indexes => {
expect(indexes.length).to.eq(1); expect(indexes.length).to.eq(1);
const index = indexes[0];
expect(index.name).to.eq('table_name_is_admin');
}); });
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!