stepwise-migrations 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3
+
4
+ name: Node.js CI
5
+
6
+ on:
7
+ push:
8
+ branches: [main]
9
+ pull_request:
10
+ branches: [main]
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ matrix:
17
+ node-version: [18.x, 20.x, 22.x]
18
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Run docker-compose
24
+ uses: hoverkraft-tech/compose-action@v2.0.1
25
+ with:
26
+ compose-file: "./docker-compose.yml"
27
+
28
+ - name: Use Node.js ${{ matrix.node-version }}
29
+ uses: actions/setup-node@v4
30
+ with:
31
+ node-version: ${{ matrix.node-version }}
32
+ cache: "npm"
33
+ - run: npm ci
34
+ - run: npm run build
35
+ - run: npm test
package/README.md CHANGED
@@ -1,18 +1,48 @@
1
1
  # Stepwise Migrations
2
2
 
3
- [![npm version](https://badge.fury.io/js/stepwise-migrations.svg?icon=si%3Anpm&)](https://badge.fury.io/js/stepwise-migrations)
4
-
5
- A tool for managing Raw SQL migrations in a Postgres database.
3
+ A JavaScript CLI tool for managing Raw SQL migrations in a Postgres database.
6
4
  Loosely based on flyway.
7
5
 
6
+ [![npm version](https://badge.fury.io/js/stepwise-migrations.svg?icon=si%3Anpm&)](https://badge.fury.io/js/stepwise-migrations)
7
+ ![test workflow](https://github.com/github/docs/actions/workflows/test.yml/badge.svg)
8
+
9
+ ## Table of Contents
10
+
11
+ - [Stepwise Migrations](#stepwise-migrations)
12
+ - [Instructions](#instructions)
13
+ - [Usage](#usage)
14
+ - [Examples](#examples)
15
+ - [Migrate](#migrate)
16
+ - [Undo](#undo)
17
+ - [Validate](#validate)
18
+ - [Audit](#audit)
19
+ - [Info](#info)
20
+ - [Get Applied Script](#get-applied-script)
21
+ - [Drop](#drop)
22
+
8
23
  ## Instructions
9
24
 
10
- Up migrations are first sorted in ascending order based on filename.
11
- No subdirectories are read below the migration directory.
25
+ There are three types of migrations:
26
+
27
+ <b>Versioned migrations</b>
28
+
29
+ - The filename must end with `.sql`.
30
+ - These are always applied in ascending order based on filename.
31
+ - Once applied, the file cannot be altered or else an error will be thrown.
32
+
33
+ <b>Repeatable migrations</b>
34
+
35
+ - Are identified by the filename ending with `.repeatable.sql`
36
+ - For things like trigger functions
37
+ - Are always applied after all versioned migrations
38
+ - When altered, the new script is applied on next migration run
39
+
40
+ <b>Undo migrations</b>
12
41
 
13
- Name the "up" migration files as `.sql` and the "down" migration files with the same name but suffixed with `.undo.sql`.
14
- e.g. `v1_users.sql` and `v1_users.undo.sql`.
15
- Down migrations are optional.
42
+ - Run on the "undo" command
43
+ - Can only be run on versioned migrations
44
+ - Are applied in reverse order of the versioned migrations
45
+ - Must have the same filename as the versioned migration but suffixed with `.undo.sql`
16
46
 
17
47
  ## Usage
18
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stepwise-migrations",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "",
5
5
  "main": "./dist/src/index.js",
6
6
  "scripts": {