I’d like to run a command in my deployment pre-start hooks which deletes the public
schema in the database and then re-creates it before running my migrations. (Kind of a wipe and replace.)
I’m having trouble finding the right command for this. This doesn’t work, and I’m not even sure if it’s the right function or approach. How can I accomplish this?
def drop_and_recreate_schema do
Ecto.Adapters.Postgres.Connection.execute_ddl("
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
")
end