Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Add how to use updated migration script info to README
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxitosh committed May 18, 2024
1 parent 7c0a897 commit d3abd65
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,34 @@ This command will generate a up and down migration in `db_migrations`
DB Migrations are applied upon server start, but as well, it can be applied manually through:
```sh
./scripts/migration.sh {--down or --up} {number_of_times}
./scripts/migration.sh -d 1
./scripts/migration.sh -u 1
```

### Usage

#### Apply Migrations

- To apply all migrations:
```sh
./scripts/migration.sh --up
```

- To apply a specific number of migrations:
```sh
./scripts/migration.sh --up 2
```

#### Rollback Migrations

- To roll back a specific number of migrations:
```sh
./scripts/migration.sh --down 2
```

- To roll back all migrations:
```sh
./scripts/migration.sh --down --all
```

## Running Tests
Install Mockery with
```
Expand Down
2 changes: 1 addition & 1 deletion scripts/migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ case $key in
DOWN_MIGRATION_NUMBER="$2"
shift
else
echo "Error: Down migration requires a specific number of migrations or -all flag to revert all migrations."
echo "Error: Down migration requires a specific number of migrations or --all flag to revert all migrations."
exit 1
fi
shift # past argument
Expand Down

0 comments on commit d3abd65

Please sign in to comment.