@@ -16,15 +16,11 @@ class ServerlessDynamodbLocal {
16
16
commands : {
17
17
migrate : {
18
18
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'
25
20
} ,
26
21
start : {
27
22
lifecycleEvents : [ 'startHandler' ] ,
23
+ usage : 'Starts local DynamoDB' ,
28
24
options : {
29
25
port : {
30
26
shortcut : 'p' ,
@@ -61,9 +57,11 @@ class ServerlessDynamodbLocal {
61
57
}
62
58
} ,
63
59
remove : {
64
- lifecycleEvents : [ 'removeHandler' ]
60
+ lifecycleEvents : [ 'removeHandler' ] ,
61
+ usage : 'Removes local DynamoDB'
65
62
} ,
66
63
install : {
64
+ usage : 'Installs local DynamoDB' ,
67
65
lifecycleEvents : [ 'installHandler' ] ,
68
66
options : {
69
67
localPath : {
@@ -103,30 +101,15 @@ class ServerlessDynamodbLocal {
103
101
} ;
104
102
}
105
103
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
-
119
104
migrateHandler ( ) {
120
105
let self = this ;
121
106
122
107
return new BbPromise ( function ( resolve , reject ) {
123
- let dynamodb = self . dynamodbOptions ( ) ,
124
- tableOptions = self . tableOptions ( ) ;
108
+ let dynamodb = self . dynamodbOptions ( ) ;
125
109
126
110
var tables = self . resourceTables ( ) ;
127
111
128
112
return BbPromise . each ( tables , function ( table ) {
129
- table . TableName = self . formatTableName ( table , tableOptions ) ;
130
113
return self . createTable ( dynamodb , table ) ;
131
114
} ) . then ( resolve , reject ) ;
132
115
} ) ;
@@ -191,9 +174,5 @@ class ServerlessDynamodbLocal {
191
174
} ) ;
192
175
} ) ;
193
176
}
194
-
195
- formatTableName ( table , options ) {
196
- return options . prefix + table . TableName + options . suffix ;
197
- }
198
177
}
199
- module . exports = ServerlessDynamodbLocal ;
178
+ module . exports = ServerlessDynamodbLocal ;
0 commit comments