Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eagerworks/sequelize-lambda-migrations
https://github.com/eagerworks/sequelize-lambda-migrations
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/eagerworks/sequelize-lambda-migrations
- Owner: eagerworks
- Created: 2022-05-24T16:59:38.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2022-06-10T18:27:11.000Z (over 2 years ago)
- Last Synced: 2024-10-11T12:37:19.915Z (3 months ago)
- Language: TypeScript
- Size: 72.3 KB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sequelize Lambda Migrations
## Usage
In order to use the package first set up the following environment variables:
- `DB_NAME`: database name
- `DB_USERNAME`: database username
- `DB_PASSWORD`: database password
- `DB_PORT`: database port
- `DB_DIALECT`: database dialect (postgress/mysql)
- `DB_HOST`: database host
- `MIGRATIONS_GLOB`: glob to the migration files (e.g. `src/db/migrations/*.js`)Then import the lambda functions from the package and use it directly on your serverless file.
`serverless.yml`
```yml
functions:
migrate:
handler: handler.migrate
timeout: 60
rollback:
handler: handler.rollback
timeout: 60
reset:
handler: handler.reset
timeout: 60
````handler.ts`
```typescript
import { migrate, rollback, reset } from '@eagerworks/sequelize-lambda-migrations';export { migrate, rollback, reset };
```One can later invoke the functions to migrate or rollback the database.
```
serverless invoke --function --stage --aws-profile --region
```