Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 29d66c9

Browse files
committed
Create table script.
1 parent d666b17 commit 29d66c9

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"clean": "gulp clean",
2121
"test:fe": "gulp protractor",
2222
"lint": "gulp lint",
23-
"heroku-postbuild": "gulp build"
23+
"heroku-postbuild": "gulp build",
24+
"create-tables": "CREATE_DB=true node scripts/create-update-tables.js"
2425
},
2526
"dependencies": {
2627
"angular": "~1.7.9",

scripts/create-update-tables.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('../src/models');

src/models/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,17 @@ if (config.DYNAMODB.IS_LOCAL === 'true') {
2222
}
2323

2424
dynamoose.setDefaults({
25-
create: true,
26-
update: true,
25+
create: false,
26+
update: false,
2727
});
2828

29+
if (process.env.CREATE_DB) {
30+
dynamoose.setDefaults({
31+
create: true,
32+
update: true,
33+
});
34+
}
35+
2936
const models = {};
3037

3138
// Bootstrap models

0 commit comments

Comments
 (0)