Skip to content

Commit

Permalink
add database migration instructions for lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
schuyler1d committed Oct 5, 2017
1 parent 72af359 commit 79f84e2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/lambda-migrate-database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"command": "runDatabaseMigrations",
"env": {
"RETHINK_KNEX_FORCE_INDEXCREATION": "1",
"RETHINK_KNEX_DEBUG": "1"
},
"description": "see docs/DEPLOYING_AWS_LAMBDA.md"
}
13 changes: 13 additions & 0 deletions docs/DEPLOYING_AWS_LAMBDA.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ NOTES:
claudia add-scheduled-event --name spoke-job-runner --schedule 'rate(5 minutes)' --event ./deploy/lambda-scheduled-event.json
```

## Migrating the database:

New migrations are added to `src/migrations/index.js`. You can trigger migration updates with the following
command:

```
claudia test-lambda --event ./deploy/lambda-migrate-database.js
```

(Note: the migration will probably take much less than the 5 minutes or whatever your lambda timeout is,
however it will look like `test-lambda` is still running/doing something. If you've confirmed on the
db side that the migration completed, it's safe to Ctrl-C)

## How this works

After Claudia.js does an 'npm install' essentially of your directory (which will filter out files in `.gitignore`, etc),
Expand Down

0 comments on commit 79f84e2

Please sign in to comment.