Skip to content

Commit 77c37ea

Browse files
committed
- migration script
1 parent da1e726 commit 77c37ea

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ $ docker run -it --rm -v $(pwd)/data:/usr/src/nasgrate/data \
9999
dlevsha/nasgrate generate MyFirstMigration
100100
```
101101

102+
You can run this line to obtain current ip
103+
104+
```bash
105+
docker exec [mysql container name] cat /etc/hosts | tail -n 1 | cut -d$'\t' -f 1
106+
```
107+
108+
You can also run bin/migration.sh script (please change params inside it)
109+
110+
```bash
111+
./migration.sh help
112+
```
113+
102114
Another option is you can view all transactions (executed and non-executed) via web interface. Just run command
103115

104116
```bash

bin/migration.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# migration scripe
4+
MIGRATION_FOLDER=[path to migration folder]
5+
ENV_FILE=[path to .env file]
6+
MYSQL_CONTAINER_NAME=[mysql container name]
7+
DOCKER_NETWORK=docker_default
8+
9+
CURRENT_IP=$(sudo docker exec $MYSQL_CONTAINER_NAME cat /etc/hosts | tail -n 1 | cut -d$'\t' -f 1)
10+
ENV_IP=$(more $ENV_FILE | grep DATABASE_HOST= | cut -d '=' -f 2)
11+
12+
echo 'Current Connection IP -> ' $CURRENT_IP
13+
echo 'Env File IP -> ' $ENV_IP
14+
15+
sudo docker run -it --rm -v $MIGRATION_FOLDER:/usr/src/nasgrate/data --net=$DOCKER_NETWORK --env-file=$ENV_FILE -e DATABASE_HOST=$CURRENT_IP dlevsha/nasgrate "$@"

0 commit comments

Comments
 (0)