https://github.com/jfollmann/knex-migrations-ts
Sample to use knex migrations with PostgreSQL and Typescript support.
https://github.com/jfollmann/knex-migrations-ts
knex knex-migrate knexjs nodejs postgres postgresql typescript
Last synced: about 1 year ago
JSON representation
Sample to use knex migrations with PostgreSQL and Typescript support.
- Host: GitHub
- URL: https://github.com/jfollmann/knex-migrations-ts
- Owner: jfollmann
- Created: 2021-08-11T18:32:12.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-12T15:53:37.000Z (almost 5 years ago)
- Last Synced: 2025-04-12T03:13:42.568Z (about 1 year ago)
- Topics: knex, knex-migrate, knexjs, nodejs, postgres, postgresql, typescript
- Language: TypeScript
- Homepage:
- Size: 43.9 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sample knex migrations with Typescript
Sample to use knex migrations with PostgreSQL and Typescript support.
## 🚀 Startup
### Start `PostgreSQL` container (with docker-compose):
```bash
docker-compose up -d
```
### Create your db in `PostgreSQL`:
```sql
create database "knexDB"
```
## ☕ Migrations
### Create migration file:
```bash
npm run migrate:make [name-of-migration]
```
### Update your database to last version:
```bash
npm run migrate:latest
```
### Rollback all migrations
```bash
npm run migrate:rollback --all
```
### Show completed and pending migrations:
```bash
npm run migrate:list
```
### Show db currentVersion:
```bash
npm run migrate:currentVersion
```
## 👌 Seeds
### Create seed file:
```bash
npm run seed:make [name-of-seed]
```
### Run all seeds:
```bash
npm run seed:run
```
[Others commands in reference document](https://knexjs.org/#Migrations-CLI)