Ecto.Migration table references to table in another schema

@OvermindDL1, thanks for mentioning!

I made it for database schema migration:

defmodule App.Repo.Migrations.CreateSchema do
  use Ecto.Migration    

  @schema_prefix Application.fetch_env!(:app, :schema_prefix)   

  def up do
    execute "create schema #{@schema_prefix}"
  end   

  def down do
    execute "drop schema #{@schema_prefix}"
  end
end

With FK, I guess it will be dropped with table during rollback.

3 Likes