You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/99xt/serverless-dynamodb-local/issues).
6
+
7
+
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/99xt/serverless-dynamodb-local/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
8
+
9
+
#### **Did you write a patch that fixes a bug?**
10
+
11
+
* Open a new GitHub pull request with the patch.
12
+
13
+
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
14
+
15
+
#### **Do you intend to add a new feature or change an existing one?**
16
+
17
+
* Suggest your change in the [Gitter](https://gitter.im/99xt/serverless-dynamodb-local?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) and start writing code.
18
+
19
+
* Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes.
20
+
21
+
#### **Do you have questions about the source code?**
22
+
23
+
* Ask any question about how to use serverless-dynamodb-local in the [Glitter](https://gitter.im/99xt/serverless-dynamodb-local?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
24
+
25
+
</br>
26
+
27
+
serverless-dynamodb-local is a volunteer effort. We encourage you to pitch in and [join the team](https://github.com/99xt/serverless-dynamodb-local/graphs/contributors)!
28
+
29
+
Thanks! :heart::heart::heart:
30
+
31
+
serverless-dynamodb-local Team
32
+
33
+
CONTRIBUTING file inspired/based on [rails contrubiting](https://github.com/rails/rails/blob/master/CONTRIBUTING.md)
* Execute a single migration. Make sure DynamoDB Local is started in another shell.
39
39
`sls dynamodb execute -n <filename>`
40
40
41
-
* Execute all migrations for DynamoDB Local.
41
+
* Execute all migrations on the remote dynamodb.
42
42
`sls dynamodb executeAll`
43
43
44
-
* Execute migration(s) in remote DynamoDB use additional parameters(region and stage) after execute/executeAll. e.g.
45
-
`sls dynamodb executeAll -r us-west-1 -s dev`
46
-
47
44
Note: Read the detailed section for more information on advanced options and configurations. Open a browser and go to the url http://localhost:8000/shell to access the web shell for dynamodb local.
48
45
49
46
## Install: sls dynamodb install
@@ -55,7 +52,7 @@ Note: This is useful if the sls dynamodb install failed in between to completely
55
52
All CLI options are optional:
56
53
57
54
```
58
-
--port -p Port to listen on. Default: 8000
55
+
--port -p Port to listen on. Default: 8000
59
56
--cors -c Enable CORS support (cross-origin resource sharing) for JavaScript. You must provide a comma-separated "allow" list of specific domains. The default setting for -cors is an asterisk (*), which allows public access.
60
57
--inMemory -i DynamoDB; will run in memory, instead of using a database file. When you stop DynamoDB;, none of the data will be saved. Note that you cannot specify both -dbPath and -inMemory at once.
61
58
--dbPath -d The directory where DynamoDB will write its database file. If you do not specify this option, the file will be written to the current directory. Note that you cannot specify both -dbPath and -inMemory at once. For the path, current working directory is <projectroot>/node_modules/serverless-dynamodb-local/dynamob. For example to create <projectroot>/node_modules/serverless-dynamodb-local/dynamob/<mypath> you should specify -d <mypath>/ or --dbPath <mypath>/ with a forwardslash at the end.
@@ -65,58 +62,38 @@ All CLI options are optional:
65
62
--migration -m After starting dynamodb local, run dynamodb migrations.
66
63
```
67
64
68
-
All the above options can be added to s-project.json to set default configuration: e.g
69
-
70
-
```json
71
-
"custom": {
72
-
"dynamodb": {
73
-
"start": {
74
-
"port": "8000",
75
-
"inMemory": true,
76
-
"migration": true
77
-
}
78
-
}
79
-
}
65
+
All the above options can be added to serverless.yml to set default configuration: e.g.
In `s-project.json` add following to customize DynamoDB Migrations file directory and table prefixes/suffixes
86
-
```json
87
-
"custom": {
88
-
"dynamodb": {
89
-
"migration": {
90
-
"dir": "dynamodbMigrations",
91
-
"table_prefix": "",
92
-
"table_suffix": ""
93
-
}
94
-
}
95
-
}
80
+
In `serverless.yml` add following to customize DynamoDB Migrations file directory and table prefixes/suffixes
81
+
```yml
82
+
custom:
83
+
dynamodb:
84
+
migration:
85
+
dir: dynamodbMigrations
86
+
table_prefix: prefix
87
+
table_suffix": suffix
96
88
```
97
89
98
-
In `s-project.json` add following to execute all the migration upon DynamoDB Local Start
99
-
```json
100
-
"custom": {
101
-
"dynamodb": {
102
-
"start": {
103
-
"migration": true
104
-
}
105
-
}
106
-
}
107
-
```
108
-
109
-
For Migration-Commands execute/executeAll following optional parameters can be used
110
-
90
+
In `serverless.yml` add following to execute all the migration upon DynamoDB Local Start
91
+
```yml
92
+
custom:
93
+
dynamodb:
94
+
start:
95
+
migration: true
111
96
```
112
-
--region -r Region that dynamodb should be remotely executed.
113
-
--stage -s Stage that dynamodb should be remotely executed.
114
-
--table_prefix -t Dynamodb Table name prefixs (E.g. for prefix = production- and abstract table-name = users, after adding the prefix it will be production-users)
115
-
--table_suffix -x Table name suffix (E.g for suffix = -test and abstract table-name = users, after adding the suffix it will be users-test )
116
-
--profile -p Use another AWS Profile to execute migration
117
-
--name -n Execute a migration template with the given name (This is only for execute command and not applicable for executeAll).
118
-
```
119
-
120
97
### Migration Template
121
98
```json
122
99
{
@@ -178,7 +155,6 @@ For Migration-Commands execute/executeAll following optional parameters can be u
178
155
"attr_2": "attr_2_value"
179
156
}]
180
157
}
181
-
182
158
```
183
159
Before modifying the migration template, refer the (Dynamodb Client SDK): http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property and (Dynamodb Document Client SDK): http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#put-property links.
184
160
@@ -206,6 +182,9 @@ new AWS.DynamoDB({
206
182
### Using with serverless-offline plugin
207
183
When using this plugin with serverless-offline, it is difficult to use above syntax since the code should use DynamoDB Local for development, and use DynamoDB Online after provisioning in AWS. Therefore we suggest you to use [serverless-dynamodb-client](https://github.com/99xt/serverless-dynamodb-client) plugin in your code.
0 commit comments