diff --git a/lib/annotations/Table.ts b/lib/annotations/Table.ts index 822b887d..84d36c91 100644 --- a/lib/annotations/Table.ts +++ b/lib/annotations/Table.ts @@ -20,7 +20,7 @@ export function Table(arg: any): void|Function { function annotate(target: any, options: IDefineOptions = {}): void { - if (!options.tableName) options.tableName = target.name; + if (options.freezeTableName === undefined) options.freezeTableName = true; options.instanceMethods = target.prototype; options.classMethods = target; diff --git a/test/specs/table_column.spec.ts b/test/specs/table_column.spec.ts index 8ac0ed74..c558a9dd 100644 --- a/test/specs/table_column.spec.ts +++ b/test/specs/table_column.spec.ts @@ -95,10 +95,10 @@ describe('table_column', () => { expect(shoeDefineOptions).not.to.be.undefined; }); - it('should have automatically inferred tableName', () => { + it('should set freezeTableName to true', () => { const userDefineOptions = getOptions(User.prototype); - expect(userDefineOptions).to.have.property('tableName', User.name); + expect(userDefineOptions).to.have.property('freezeTableName', true); }); it('should have explicitly defined tableName', () => {