Open akosasante opened 3 years ago
I have a fork that will do this. It's not too difficult in my fork.
...
username: "someone",
password: "******",
module_name: "SomeModule",
type: :postgres,
schemas: [ "debt", "accounts"] # the default is 'public' if you don't specify any schemas
And then it generates the schema by and adds the Ecto prefix for them like this (note the @schema_prefix):
defmodule SomeModule.Invoice do
use Ecto.Schema
import Ecto.Changeset
@schema_prefix "debt"
@primary_key false
schema "invoice" do
field :billing_date, :date, primary_key: false
...
I'm still working on the changes. I was going to change the Module name so that it is namespaced as well because you might have same table name in multiple schemas... like this:
SomeModule.Debt.Invoice
I could generate a pull request but probably need some help testing and finalizing...
Is it possible to pass a schema/prefix to the library if my Postgres tables are in a schema different from the default 'public' one? For ecto itself, I'm able to do this by setting a prefix, following the instructions in the Ecto docs:
But not sure how to do something similar with Plsm.