Launching Evolutions on the command line

This is my first day working with the Play framework, and it's hard for me with evolution. I am using Play 2.4.

I chose the example of the many applications that appear activator ui, it uses play-slickand play-slick-evolutionsto connect to the database and evolution.

I looked through the docs but can't find a way to start evolution from the command line. When I run activatoron bash, they throw me into the shell and helpsay nothing about running evolutions or smooth ones.

I've been doing PHP for a while, so I'm used to running them up / down from the command line. I can delete the tables from the database client and activator runwhich should encourage me to start evolution, but I'm looking for the right, manual way to do this. I believe this is possible, as it should be done during deployment.

+9
source share
2 answers

As far as I know, they are not intended to be started manually. In development, Play will ask you to complete them: Play evolution script application

"" , -DapplyEvolutions.default=true. ( -D, ) application.conf, . -DapplyUpEvolutions.default=true -DapplyDownEvolutions.default=true.

, , script, , . , Play, , play_evolutions. , .

+13

, :

export PGPASSWORD=<password>
for SQL_FILE in $(ls <path-to-evolution-files>); do
    psql -h localhost -U <username> -c "$(sed '1,/Ups/d' <path-to-evolution-files>/$SQL_FILE | sed -n '/Downs/q;p')";
done

Ups Downs Postgres.

+1

Source: https://habr.com/ru/post/1609879/


All Articles