Is there a way to check if there is a pending migrate before running the actual migration with the flyway cli? - flyway

I want to be able to run a command and determine if there is a pending migration. This is going to be scripted so the best thing would be a command that returns easy to parse output.
The only command I could find for this is info but the output stinks. I want to confirm if there is a way to get parsable output.
For example this command:
flyway -locations="filesystem:schema_migration_files" \
-user="userxyz" \
-password="lsdkfklsdfjld" \
-url=jdbc:postgresql://myserver:5432/mydb \
info
Gives me this atrocious output:
I can parse that mess myself. I would probably just check if string "Pending" is in the output, but I'm not sure how reliable that would be. I just need to determine if there is or isn't a pending migration.

You can use the -outputType=json command line argument, and then parse the output.

Related

Fastlane - use current git tag as version number

I'm trying to use the latest tag on a branch as the version number in an iOS project, using Fastlane.
If I run git describe --abbrev=0 --tags in my terminal I can see the latest tag output.
I'd like to pipe this value into increment_version_number in Fastlane.
To test this I have run -
fastlane action increment_version_number(version_number: $(git describe --abbrev=0 --tags))
in my terminal, but the output I get is
zsh: unknown file attribute: v
increment_version_number docs
Is it possible to do this?
Thanks
Running the command in the terminal has a different syntax - you need to supply the arguments inline.
fastlane run increment_version_number version_number:$(git describe --abbrev=0 --tags)"

Deleting a command from zsh history

I'm writing a shell history application, and I'm experiencing issues with deleting a command from zsh history. When I was developing bash compatibility, I used readline to manipulate history - I first deleted command from readline's history, then wrote the history to a file. After the program exits, if the history was manipulated, then I do history -r and I get the expected behavior. Since zsh does not use readline and its history command significantly differs from the one that can be found on bash, I'm left with no other choice but to manipulate the history file directly. However, when I do that, the changes are not reflected until the shell is restarted. I have tried to use zsh's equivalent of history -r, which is supposed to be fc -R, but I did not get the expected results. While the command gets deleted from history after running that, pressing the up arrow (in order to go back to the previous command, which should be the one that invoked the program) brings me to a seemingly random command in the history.
I'd appreciate it if someone explained the odd behavior I'm experiencing. Any pointers in the right direction are also welcome.
I have solved this problem in my Zsh history editing plugin zsh-hist by not touching the histfile directly, but instead doing everything through Zsh's own mechanisms:
Set $HISTORY_IGNORE locally to a pattern that matches the contents of the entries you want to delete.
Use fc -W to write the history to file. Because of HISTORY_IGNORE, the unwanted entries will not be written.
Use fc -p to create a new history from file.
Zsh documentation:
$HISTORY_IGNORE parameter
fc builtin command

How to execute migration current version using "Symfony doctrine migrations" without any interaction?

As doctrine migrations help says:
Or you can also execute the migration without a warning message which you need to interact with:
./bin/console doctrine:migrations:migrate --no-interaction
I try to run current migration version by command:
./bin/console doctrine:migrations:migrate current --no-interaction
Nevertheless, I always get an error:
WARNING! You have 1 previously executed migrations in the database that are not registered migrations.
>> 2020-01-29 13:03:03 (20200129130303)
No migrations to execute.
Of course, I clearly understand that "I have 1 previously executed migrations".
And It is my goal to execute a specific old version without any interaction. How can I achieve it?
That's not an error, that's just warning. It's displayed for the reasons #rkeet mentioned in comment. The command is still executed without interaction.
If you do not want to see any output, you should use --quiet, -q flag.
Interaction is when Symfony asks you Are you sure you want to execute migrations? (or whatever the messages are), and you answer with either y or n. This part is omitted with a --no-interaction flag.

How to see logs of running robot script?

The robot scripts when ran on RIDE, generate output.xml, report.html etc files, once run is over.
Is there any way available to view logs when script is still running? (When I use pause on failure)
Also some times I had to Stop/Abort the run in middle, and no logs are generated in such cases.
Kindly help,
Thanks in advance
As for first part — RIDE runs tests adding own listener, providing more verboseness of the output and pausing/resuming functionality.The easiest thing is to run tests not from RIDE, but from console using robot/pybot script. In this case much less logs are written to output (though it doesn't provide pause/resume functionality).
For second part — robot (RIDE starts robot script — you can see it in execution log: command: pybot.bat...) generates output.xml file not after but during execution, so generated output.xml is not valid until test is finished. After normal execution rebot tool generating log.html automatically. So generally it's possible to take following steps:
"Fix" your incomplete output.xml file after execution stop with fixml. output.xml location for RIDE execution can be found in the very same execution log of yours (e.g. ...\appdata\local\temp\RIDEv_0yrp.d\ in my case)
Run rebot stand-alone: rebot output.xml --log log.html --report report.html. Rebot options description you can check using rebot --help (as usual)
Please also note that directory where RIDE output files are stored is temporary — exists only when RIDE is started. You will lose your output on exiting RIDE
I'm using RIDE 1.5 so maybe my answer is not valid for other versions
In RIDE, under Run Tab , when you are running the scripts , you have a option, show message log, it will shows the runtime log.
Try this out.

Zsh wants to autocorrect a command, with an _ before it

I just started using Zsh lately for some of the integrated support in the shell prompt for my Git status etc.
When I type in:
ruby -v
to confirm the version of ruby I'm running, Zsh asks if I want to change the command to _ruby. Well after saying no at the prompt and the command completing as expected I continue to get the question at the prompt after confirming my command is correct.
I'm assuming there is a completion file or something of the sort.
Thanks
Update:
The shell is no longer trying to complete _ruby, it stopped responding after closing the shell a few times some how.
I tried to clean the file up several times but there is a "opts" variable that is 50 or more lines long and the lines are all ran together, some lines more than 150 characters. Maybe I could email an attachment to you if you still want to see it.
I sincerely apologize for the messy post.
This is command autocorrection, activated by the correct option. It has nothing to do with completion. You're seeing _ruby because zsh thinks there is no ruby command and it offers _ruby as the nearest existing match.
If you've just installed ruby, it's possible that zsh has memorized the list of available command earlier, and it won't always try to see if the command has appeared in between. In that case, run hash -rf. Future zsh sessions won't have this problem since the ruby command already existed when they started.
Sometimes, when you change your PATH, zsh forgets some hashed commands. The option hash_listall helps against this. As above, if you can force zsh to refresh its command cache with hash -rf.
You could make an alias:
alias ruby='nocorrect ruby'
It's what I did when zsh kept asking me if I meant .meteor when I typed meteor because auto-correct is still useful from time to time.
I find the autocorrect feature can get annoying at times. So I do in my ~/.zshrc,
DISABLE_CORRECTION="true"
I had the same problem even when the command is not installed.
I can solve it using the CORRECT_IGNORE variable in my .zshrc
# OPTs to enable
setopt HASH_LIST_ALL
setopt CORRECT
# Zsh variable to determine what to ignore,
# in this case everything starting with _ or .
CORRECT_IGNORE="[_|.]*"
I hope it helps to you or anyone with this issue
Sometime ago after an update, I got command auto-correction enabled which I don't want. If the same happened to you and you want to revert it, in the ~/.zshrc file you'll have make it:
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="false"
or comment it as per bellow:
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
Just a note, on my zsh (version 5.7.1 on macOS), the DISABLE_CORRECTION didn't work.
I saw in my .zshrc file the following two lines, which I then commented out
setopt CORRECT
setopt CORRECT_ALL
That did it for me.

Resources