migrate-hack 0.1.2 → 0.1.4
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.
- checksums.yaml +4 -4
- data/bin/migrate-hack.sh +13 -9
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffb5f1e4e8e2f85c42dd4c5a06c2cde72d3501331e17df0574ab4363910ac119
|
4
|
+
data.tar.gz: 636817b408fed119bb70a75358da8079597012a77b0f1efc687193b4d615d23b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ec5ccb533fdceaebb595e277630d63fb1c6ce8dfded8f8b571d4d527c1d32392aa0bd503f895c624186fd2273a487196a1710e50b7bc0e6995d80a921252a1a
|
7
|
+
data.tar.gz: 13aee5426ccfab40f89501344573360e69cfa3ffea79fcb648c1c5cb8455773f0ed64bd5ba7031064226c9233401ec7c3ed34fe7e8cd6132c5ee9cea4be4b439
|
data/bin/migrate-hack.sh
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
ENV_FILE=""
|
4
4
|
COPY_DIR=""
|
5
5
|
|
6
|
+
if [[ -n $(git status --porcelain) ]]; then
|
7
|
+
echo "[error] There are modified, deleted, or untracked files in the repository. Please resolve these changes before continuing."
|
8
|
+
exit 1
|
9
|
+
fi
|
10
|
+
|
6
11
|
while [[ $# -gt 0 ]]; do
|
7
12
|
key="$1"
|
8
13
|
case $key in
|
@@ -47,11 +52,6 @@ if [ -n "$COPY_DIR" ]; then
|
|
47
52
|
fi
|
48
53
|
fi
|
49
54
|
|
50
|
-
if [[ -n $(git status --porcelain) ]]; then
|
51
|
-
echo "[error] There are modified, deleted, or untracked files in the repository. Please resolve these changes before continuing."
|
52
|
-
exit 1
|
53
|
-
fi
|
54
|
-
|
55
55
|
echo "Detecting pending migrations..."
|
56
56
|
|
57
57
|
# 1. Get pending migrations list
|
@@ -85,13 +85,17 @@ while read -r TIMESTAMP MIGRATION COMMIT; do
|
|
85
85
|
echo -e "\033[1;32m - migrate\033[0m"
|
86
86
|
bundle exec rails db:migrate:up VERSION=$MIGRATION
|
87
87
|
|
88
|
-
|
89
|
-
|
88
|
+
if [[ -n $(git status --porcelain) ]]; then
|
89
|
+
git stash -u > /dev/null
|
90
|
+
git stash drop > /dev/null
|
91
|
+
fi
|
90
92
|
git checkout main > /dev/null
|
91
93
|
done < <(sort -n "$TEMP_FILE")
|
92
94
|
|
93
|
-
|
94
|
-
git
|
95
|
+
if [[ -n $(git status --porcelain) ]]; then
|
96
|
+
git stash -u > /dev/null
|
97
|
+
git stash drop > /dev/null
|
98
|
+
fi
|
95
99
|
|
96
100
|
bundle exec rails db:migrate:status | grep down
|
97
101
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: migrate-hack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Zillner
|
@@ -9,8 +9,15 @@ bindir: bin
|
|
9
9
|
cert_chain: []
|
10
10
|
date: 2025-03-25 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
|
-
description:
|
13
|
-
step by step.
|
12
|
+
description: |+
|
13
|
+
Ideal for deterministic pipelines, CI/CD, or containers that apply migrations step by step.
|
14
|
+
|
15
|
+
--------------------------------
|
16
|
+
|
17
|
+
⚠️ Warning: This gem modifies the files in the repository where it is executed according to git history, but then restores everything to normal.
|
18
|
+
Do not run it on servers that are actively serving the application.
|
19
|
+
Run it in parallel.
|
20
|
+
|
14
21
|
email:
|
15
22
|
- carlos@function.ws
|
16
23
|
executables:
|
@@ -43,3 +50,4 @@ rubygems_version: 3.6.6
|
|
43
50
|
specification_version: 4
|
44
51
|
summary: Runs old migrations without conflicts
|
45
52
|
test_files: []
|
53
|
+
...
|