@@ -13,11 +13,11 @@ defmodule Demo.Release do
1313 @ doc """
1414 Migrate the database.
1515 """
16- def migrate ( direction \\ :up ) do
16+ def migrate do
1717 init ( [ :ssl ] )
1818
1919 for repo <- repos ( ) do
20- { :ok , _fun_return , _apps } = Ecto.Migrator . with_repo ( repo , & Ecto.Migrator . run ( & 1 , direction , all: true ) )
20+ { :ok , _fun_return , _apps } = Ecto.Migrator . with_repo ( repo , & Ecto.Migrator . run ( & 1 , :up , all: true ) )
2121 end
2222 end
2323
@@ -26,7 +26,7 @@ defmodule Demo.Release do
2626 """
2727 # sobelow_skip ["RCE.CodeModule"]
2828 def seed do
29- init ( [ :crypto , :ssl , :myxql , :ecto , :ecto_sql , :faker ] )
29+ init ( [ :crypto , :ssl , :postgrex , :ecto , :ecto_sql , :faker ] )
3030
3131 Enum . each ( repos ( ) , & & 1 . start_link ( pool_size: 1 ) )
3232
@@ -36,10 +36,19 @@ defmodule Demo.Release do
3636 end
3737
3838 @ doc """
39- Reset the application.
39+ Reset the application by dropping and recreating the public schema .
4040 """
4141 def reset do
42- migrate ( :down )
42+ init ( [ :ssl ] )
43+
44+ for repo <- repos ( ) do
45+ { :ok , _fun_return , _apps } =
46+ Ecto.Migrator . with_repo ( repo , fn repo ->
47+ repo . query! ( "DROP SCHEMA public CASCADE" )
48+ repo . query! ( "CREATE SCHEMA public" )
49+ end )
50+ end
51+
4352 migrate ( )
4453 seed ( )
4554 end
0 commit comments