Closed onurkose closed 1 year ago
After further investigation, even after upgrading the config to the new version, table name settings were not able to read from config service:
import { DynamooseModule } from 'nestjs-dynamoose';
import { UserSchema } from './user.schema';
import { UserService } from './user.service';
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true }),
DynamooseModule.forFeatureAsync([
{
name: 'User',
useFactory: (_, configService: ConfigService) => {
return {
schema: UserSchema,
options: {
tableName: configService.get<string>('USER_TABLE_NAME'), <-- This won't work anymore, table name defaults to User automatically.
},
};
},
inject: [ConfigService],
},
]),
],
providers: [
UserService,
...
],
})
export class UserModule {}
@onurkose i just tested without any problem, are u using dynamoose version 3.2.0?
yes, it's dynamoose 3.2.0 I just downgraded nestjs-dynamoose to 0.5.3 and it works just fine.
@onurkose I tested using aws-nestjs-starter without any problem, since it won't use the dynamoose auto table create feature, if you are using dynamoose auto table create feature, please report to dynamoose about this bug.
https://github.com/hardyscc/nestjs-dynamoose/commit/15a06f2cce1ab4024c89a92661eb82bed69b5c97 should only affect a model name, and not a table name.
It would be great if you fork aws-nestjs-starter and reproduce your problem so that i can debug it and contribute a hot fix
@onurkose I also tested the dynamoose auto create table feature using options.tableName, it also works correctly.
I confirm this issue. The "tableName" doesn't work anymore. It created a "tenants" table based on the "name".
and this works.
dude, you really need to do the semantic versioning and change the major version when involves breaking changes.
@ianzone I will try my best to keep semantic versioning...
I'm submitting a...
Current behavior
This is a breaking change and requires proper versioning.
Expected behavior
I was running into a simple problem with aws serverless and needed to dump node_modules and hit npm install afterwards. Because of the config change, all my table names defaulted to model names. When the models start running on production it re-created all tables because the table names mismatched.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment