Play Framework 2.3 how to reset a database?

Evolutions documentation 2.3.x says

In development mode, however, it is often easier to simply flush the development database and reuse all evolution from the very beginning.

However, he does not give instructions on how to do this. Is there some kind of activator command that I can use for this? How can I reset and reuse evolution?

Thanks!

Update: I would prefer not to contact my database manually, but it seems like the only way

+5
source share
2 answers

If you do not need the data that you have in your database (make sure you have not done so), you can simply drop the database using the sql command (for example, "drop database name"). When you run "play run" again, it should automatically recreate your tables from sql scripts if you followed the standard frame standards, as according to the document:

"Evolution is automatically activated if the database is configured in application.conf and evolution scenarios exist."

+2
source

I do not think that there is such an activator team that would repeat all evolution.

Evolution consists of 2 parts Ups and Downs, where

  • The Up part describes the necessary conversions.
  • The Downs part describing how to get them back.

    when you apply evolution for the first time, when part of Ups is applied, and if later on you change the scheme through entity.It will reuse evolutions in ebean.

If you want to go back to creating a new dotsql file, say 2.sql with the Ups part of all drop statements.

Under this

In development mode, however, it is often easier to simply destroy the development databases and reuse all evolution from the very beginning.

I think they want to manually delete the entire database through your gui database, etc.

Also check out Similar

+2
source

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


All Articles