Navigation Menu

Skip to content

Commit

Permalink
Calculate table names correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 3, 2012
1 parent 28f9405 commit 701f07f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions lib/database/domain.js
Expand Up @@ -145,18 +145,19 @@ Domain.prototype = {
return string;
},

get referenceTableBaseName() {
if (!this._referenceTableBaseName)
this._referenceTableBaseName = REFERENCE_TABLE_PREFIX + '_' +
this.toTableNamePart(this.name);
return this._referenceTableBaseName;
},

get termsTableName() {
if (!this._termsTableName)
this._termsTableName = REFERENCE_TABLE_PREFIX + '_' +
this.toTableNamePart(this.name) + '_BigramTerms';
return this._termsTableName;
return this.referenceTableBaseName + '_BigramTerms';
},

get synonymTableName() {
if (!this._synonymTableName)
this._synonymTableName = REFERENCE_TABLE_PREFIX + '_' +
this.toTableNamePart(this.name) + '_synonyms';
return this._synonymTableName;
return this.referenceTableBaseName + '_synonyms';
},

getIndexField: function(field) {
Expand Down Expand Up @@ -185,6 +186,7 @@ Domain.prototype = {
this._id = value;
// clear caches
delete this._tableName;
delete this._referenceTableBaseName;
delete this._termsTableName;
delete this._synonymTableName;
return value;
Expand Down
4 changes: 2 additions & 2 deletions lib/database/index-field.js
Expand Up @@ -62,12 +62,12 @@ IndexField.prototype = {
},
get indexColumnName() {
if (!this._indexColumnName)
this._indexColumnName = this.domain.tableName + '_' + this.columnName;
this._indexColumnName = this.domain.referenceTableBaseName + '_' + this.columnName;
return this._indexColumnName;
},
get referenceTableName() {
if (!this._referenceTableName)
this._referenceTableName = this.domain.tableName + '_' + this.columnName;
this._referenceTableName = this.domain.referenceTableBaseName + '_' + this.columnName;
return this._referenceTableName;
},
get referenceTableKeyType() {
Expand Down

0 comments on commit 701f07f

Please sign in to comment.