Skip to content

Commit

Permalink
Merge pull request #44 from marianozunino/feat/transaction-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
marianozunino authored Oct 31, 2024
2 parents b6b6688 + 07ee812 commit 989fe4d
Show file tree
Hide file tree
Showing 18 changed files with 439 additions and 85 deletions.
33 changes: 14 additions & 19 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# This is a basic workflow that is manually triggered

name: build-deploy

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
push:
branches:
Expand All @@ -12,19 +8,15 @@ on:
branches:
- master

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Build and deploy all the components
build-deploy:
name: Build-and-Deploy
runs-on: ubuntu-latest

steps:
# Get deploy code
- name: Checkout
uses: actions/checkout@v2
with:
# This is important for semantic-release to have access to the full history
fetch-depth: 0

- name: Get npm cache
Expand All @@ -40,21 +32,23 @@ jobs:
with:
node-version: 'lts/*'

# Build using the custom script (sam build + custom builds)
- name: Build
shell: bash
- name: Install Dependencies
run: npm ci
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
npm ci
npm run build

- name: Generate oclif artifacts
run: |
# Generate readme
npm run prepack
- name: Build
run: npm run build

- name: Test
run: npm run test:cov

- name: Generate oclif Artifacts
run: |
npm run build
npx oclif manifest
npx oclif readme
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add README.md
Expand All @@ -73,10 +67,11 @@ jobs:
['master']
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: './coverage/lcov.info'

12 changes: 5 additions & 7 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"require": [
"ts-node/register"
],
"watch-extensions": [
"ts"
],
"require": ["ts-node/register"],
"watch-files": ["src/**/*.ts", "test/**/*.ts"],
"watch-extensions": ["ts"],
"recursive": true,
"reporter": "spec",
"timeout": 60000
"timeout": 60000,
"extension": ["ts"]
}
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ $ npm install -g morpheus4j
$ morpheus COMMAND
running command...
$ morpheus (--version)
morpheus4j/4.1.0 linux-x64 node-v20.13.1
morpheus4j/4.1.0 linux-x64 node-v20.16.0
$ morpheus --help [COMMAND]
USAGE
$ morpheus COMMAND
Expand Down Expand Up @@ -177,7 +177,7 @@ Generate a new timestamped migration file with boilerplate code

```
USAGE
$ morpheus create NAME [-c <value>] [-m <value>]
$ morpheus create NAME [--json] [-c <value>] [-m <value>]
ARGUMENTS
NAME Name of the migration (will be prefixed with a semver number)
Expand All @@ -186,6 +186,9 @@ FLAGS
-c, --configFile=<value> Path to the morpheus file. ./morpheus.json by default
-m, --migrationsPath=<value> Migrations path. Env: 'MORPHEUS_MIGRATIONS_PATH'
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Generate a new timestamped migration file with boilerplate code
Expand Down Expand Up @@ -270,18 +273,20 @@ Execute pending database migrations in sequential order
```
USAGE
$ morpheus migrate [--json] [--debug] [-c <value>] [-m <value>] [-h <value>] [-p <value>] [-s <value>] [-P
<value>] [-u <value>] [-d <value>] [--dry-run]
<value>] [-u <value>] [-d <value>] [--dry-run] [--transaction-mode PER_MIGRATION|PER_STATEMENT]
FLAGS
-P, --password=<value> Neo4j password. Env: 'MORPHEUS_PASSWORD'
-c, --configFile=<value> Path to the morpheus file. ./morpheus.json by default
-d, --database=<value> Neo4j database. Env: 'MORPHEUS_DATABASE'
-h, --host=<value> Neo4j host. Env: 'MORPHEUS_HOST'
-m, --migrationsPath=<value> Migrations path. Env: 'MORPHEUS_MIGRATIONS_PATH'
-p, --port=<value> Neo4j port. Env: 'MORPHEUS_PORT'
-s, --scheme=<value> Neo4j scheme. Env: 'MORPHEUS_SCHEME'
-u, --username=<value> Neo4j username. Env: 'MORPHEUS_USERNAME'
--dry-run Perform a dry run - no changes will be made to the database
-P, --password=<value> Neo4j password. Env: 'MORPHEUS_PASSWORD'
-c, --configFile=<value> Path to the morpheus file. ./morpheus.json by default
-d, --database=<value> Neo4j database. Env: 'MORPHEUS_DATABASE'
-h, --host=<value> Neo4j host. Env: 'MORPHEUS_HOST'
-m, --migrationsPath=<value> Migrations path. Env: 'MORPHEUS_MIGRATIONS_PATH'
-p, --port=<value> Neo4j port. Env: 'MORPHEUS_PORT'
-s, --scheme=<value> Neo4j scheme. Env: 'MORPHEUS_SCHEME'
-u, --username=<value> Neo4j username. Env: 'MORPHEUS_USERNAME'
--dry-run Perform a dry run - no changes will be made to the database
--transaction-mode=<option> [default: PER_MIGRATION] Transaction mode
<options: PER_MIGRATION|PER_STATEMENT>
GLOBAL FLAGS
--debug Enable debug logging
Expand All @@ -296,6 +301,10 @@ EXAMPLES
$ morpheus migrate -m ~/path/to/migrations
$ morpheus migrate --config ./custom-config.json
$ morpheus migrate --dry-run
$ morpheus migrate --transaction-mode=PER_STATEMENT
```

_See code: [src/commands/migrate.ts](https://github.com/marianozunino/morpheus/blob/v4.1.0/src/commands/migrate.ts)_
Expand Down
3 changes: 2 additions & 1 deletion morpheus.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"database": "neo4j",
"host": "localhost",
"migrationsPath": "neo4j/migrations",
"password": "password",
"password": "neo4j",
"port": 7687,
"scheme": "neo4j",
"transactionMode": "PER_MIGRATION",
"username": "neo4j"
}
Loading

0 comments on commit 989fe4d

Please sign in to comment.