migrate-hack 0.1.3 → 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/migrate-hack.sh +13 -9
  3. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75b30fd22d05d321481f2a999869e390590ca4ea4b19ca4894129804683e6fc3
4
- data.tar.gz: 2aade6f3312e932e1b6890f8a2e61276d9f2f9a955d248e13010f53c7f52269d
3
+ metadata.gz: ffb5f1e4e8e2f85c42dd4c5a06c2cde72d3501331e17df0574ab4363910ac119
4
+ data.tar.gz: 636817b408fed119bb70a75358da8079597012a77b0f1efc687193b4d615d23b
5
5
  SHA512:
6
- metadata.gz: 4600ede448f5cef313151007e022189d8981228f6675a76ff223b305a78983a7601fed7fcb5328cac05c3c25f756c1db2b98058d941460375aba3ae2e7bc0009
7
- data.tar.gz: fe28c1d324d7384b3c16c88c69449138d7c27b40229b90b9bfe7a7935d09a4100b5231a0eefa2204ee36e702275fb1347816297211bf118023986a7819ab7ab3
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
- git stash -u > /dev/null
89
- git stash drop > /dev/null
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
- git stash -u > /dev/null
94
- git checkout main > /dev/null
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Zillner
@@ -9,12 +9,15 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 2025-03-25 00:00:00.000000000 Z
11
11
  dependencies: []
12
- description: |
12
+ description: |+
13
13
  Ideal for deterministic pipelines, CI/CD, or containers that apply migrations step by step.
14
+
14
15
  --------------------------------
15
- ⚠️ Warning: This gem modifies the files in the repository where it is executed but then restores everything to normal.
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.
16
18
  Do not run it on servers that are actively serving the application.
17
19
  Run it in parallel.
20
+
18
21
  email:
19
22
  - carlos@function.ws
20
23
  executables:
@@ -47,3 +50,4 @@ rubygems_version: 3.6.6
47
50
  specification_version: 4
48
51
  summary: Runs old migrations without conflicts
49
52
  test_files: []
53
+ ...