db-evo 1.1.2 → 1.1.3
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.
- package/README.md +21 -10
- package/package.json +1 -1
package/README.md
CHANGED
@@ -38,9 +38,13 @@ migrations/
|
|
38
38
|
│ └── 01-create-posts.sql
|
39
39
|
```
|
40
40
|
|
41
|
-
2. Configure database connection in
|
41
|
+
2. Configure database connection in `.db-evorc.yaml`:
|
42
42
|
|
43
43
|
```yaml
|
44
|
+
patch: "00"
|
45
|
+
env: "default"
|
46
|
+
roots:
|
47
|
+
- "~/workspace/projects/myapp/db/migrations"
|
44
48
|
pg:
|
45
49
|
default:
|
46
50
|
dbname: myapp
|
@@ -52,8 +56,10 @@ pg:
|
|
52
56
|
|
53
57
|
3. Deploy migrations:
|
54
58
|
|
59
|
+
Run command from folder, where `.db-evorc.yaml` file placed.
|
60
|
+
|
55
61
|
```bash
|
56
|
-
db-evo deploy
|
62
|
+
db-evo deploy --env=production
|
57
63
|
```
|
58
64
|
|
59
65
|
## Commands
|
@@ -68,7 +74,7 @@ db-evo deploy
|
|
68
74
|
|
69
75
|
## Configuration
|
70
76
|
|
71
|
-
Create
|
77
|
+
Create `.db-evorc.yaml` files to configure migrations:
|
72
78
|
|
73
79
|
```yaml
|
74
80
|
# Root configuration
|
@@ -87,29 +93,34 @@ pg:
|
|
87
93
|
production:
|
88
94
|
dbname: myapp_prod
|
89
95
|
host: prod.example.com
|
96
|
+
```
|
90
97
|
|
98
|
+
Create `~/workspace/projects/myapp/db/migrations/01/db-evo.yaml` file to configure migration:
|
99
|
+
|
100
|
+
```yaml
|
91
101
|
# Per-migration configuration
|
92
|
-
depends: ["00"] # Require patch 00 before applying
|
93
|
-
includes: ["shared"] # Include shared migrations
|
102
|
+
depends: ["00"] # Require patch 00 before applying (optional)
|
103
|
+
includes: ["shared"] # Include shared migrations (optional)
|
94
104
|
```
|
95
105
|
|
96
106
|
## Migration Structure
|
97
107
|
|
98
|
-
Each migration patch follows this structure:
|
108
|
+
Each migration patch follows this structure (see `roots` config parameter):
|
99
109
|
|
100
110
|
```text
|
101
111
|
patch-name/
|
102
|
-
├── db-evo.yaml #
|
103
|
-
├── vars.yaml # Variables for templates (optional)
|
112
|
+
├── db-evo.yaml # Migration configuration
|
104
113
|
├── deploy/ # Forward migration scripts
|
105
114
|
│ ├── 01.sql
|
106
115
|
│ └── 02.sql
|
107
|
-
├── revert/ # Rollback scripts
|
116
|
+
├── revert/ # Rollback scripts
|
108
117
|
│ └── 01.sql
|
109
|
-
└── verify/ # Verification scripts
|
118
|
+
└── verify/ # Verification scripts
|
110
119
|
└── 01.sql
|
111
120
|
```
|
112
121
|
|
122
|
+
Each SQL script must be a valid script for `psql`.
|
123
|
+
|
113
124
|
## Options
|
114
125
|
|
115
126
|
- `--env <env>` - Target environment (default: "default")
|