Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-Schema database #404

Closed
alex-lairan opened this issue Jan 18, 2022 · 1 comment
Closed

Multi-Schema database #404

alex-lairan opened this issue Jan 18, 2022 · 1 comment

Comments

@alex-lairan
Copy link

Describe the bug

Context :

  • Postgres
  • 2 schema (public, x)

When using a multi-schema database, we have to qualify tables that are not on the current_schema.

e.g

class XFoo< ROM::Relation[:sql]
  schema(Sequel::SQL::QualifiedIdentifier.new('x', 'foo'), as: :x_foo, infer: true) do
    attribute :id, Types::Integer
    attribute :value, Types::Float
    attribute :bar_id, Types::ForeignKey(:bar)

    primary_key :id

    associations do 
      belongs_to :bars, as: :bar, foreign_key: :bar_id
    end
  end
end

The line ROM.env.relations[:x_foo].to_a don't find the table "'x'.'foo'".

How could I replace the Sequel::SQL::QualifiedIdentifier.new?
If this needs more dev, how can I help? :)

To Reproduce

Create a database with 2 schemas, one table each.
Create a relation for both tables.

Expected behavior

I should be able to query 'x'.'foo' and not "'x'.'foo'"

My environment

  • Affects my production application: YES
  • Ruby version: 2.7.4
  • OS: All
@flash-gordon
Copy link
Member

It's a duplicate of #163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants