Skip to content

Commit 08c48fb

Browse files
committed
Removes the ability to set a prefix or suffix on table names. They will be exactly as they are in the Resources specification. Adds usage to top-level commands.
1 parent b3c2acb commit 08c48fb

File tree

2 files changed

+8
-38
lines changed

2 files changed

+8
-38
lines changed

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,6 @@ custom:
6868

6969
## Migrations: sls dynamodb migrate
7070
### Configurations
71-
In `serverless.yml` add following to customize DynamoDB Migrations table prefixes/suffixes
72-
```yml
73-
custom:
74-
dynamodb:
75-
migration:
76-
table_prefix: prefix
77-
table_suffix": suffix
78-
```
79-
8071
In `serverless.yml` add following to execute all the migration upon DynamoDB Local Start
8172
```yml
8273
custom:
@@ -150,4 +141,4 @@ Now your local DynamoDB database will be automatically started before running `s
150141
* [NPM Registry](https://www.npmjs.com/package/serverless-dynamodb-local)
151142

152143
## License
153-
[MIT](LICENSE)
144+
[MIT](LICENSE)

index.js

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@ class ServerlessDynamodbLocal {
1616
commands: {
1717
migrate: {
1818
lifecycleEvents: ['migrateHandler'],
19-
options: {
20-
stage: {
21-
shortcut: 'm',
22-
usage: 'Create DynamoDB tables from the current serverless configuration'
23-
}
24-
}
19+
usage: 'Creates local DynamoDB tables from the current Serverless configuration'
2520
},
2621
start: {
2722
lifecycleEvents: ['startHandler'],
23+
usage: 'Starts local DynamoDB',
2824
options: {
2925
port: {
3026
shortcut: 'p',
@@ -61,9 +57,11 @@ class ServerlessDynamodbLocal {
6157
}
6258
},
6359
remove: {
64-
lifecycleEvents: ['removeHandler']
60+
lifecycleEvents: ['removeHandler'],
61+
usage: 'Removes local DynamoDB'
6562
},
6663
install: {
64+
usage: 'Installs local DynamoDB',
6765
lifecycleEvents: ['installHandler'],
6866
options: {
6967
localPath: {
@@ -103,30 +101,15 @@ class ServerlessDynamodbLocal {
103101
};
104102
}
105103

106-
tableOptions(table_prefix, table_suffix) {
107-
let self = this;
108-
let config = self.service.custom.dynamodb,
109-
migration = config && config.migration || {},
110-
suffix = table_suffix || migration.table_suffix || '',
111-
prefix = table_prefix || migration.table_prefix || '';
112-
113-
return {
114-
suffix: suffix,
115-
prefix: prefix
116-
};
117-
}
118-
119104
migrateHandler() {
120105
let self = this;
121106

122107
return new BbPromise(function (resolve, reject) {
123-
let dynamodb = self.dynamodbOptions(),
124-
tableOptions = self.tableOptions();
108+
let dynamodb = self.dynamodbOptions();
125109

126110
var tables = self.resourceTables();
127111

128112
return BbPromise.each(tables, function (table) {
129-
table.TableName = self.formatTableName(table, tableOptions);
130113
return self.createTable(dynamodb, table);
131114
}).then(resolve, reject);
132115
});
@@ -191,9 +174,5 @@ class ServerlessDynamodbLocal {
191174
});
192175
});
193176
}
194-
195-
formatTableName(table, options) {
196-
return options.prefix + table.TableName + options.suffix;
197-
}
198177
}
199-
module.exports = ServerlessDynamodbLocal;
178+
module.exports = ServerlessDynamodbLocal;

0 commit comments

Comments
 (0)