Model create not respecting schema
u89012 opened this issue · 3 comments
u89012 commented
The following queries fine but doesn't create, could be a bug I think. Can someone please confirm?
module Products
class Listing
include Clear::Model
self.schema = "products"
self.table = "listings"
column id : Int64, primary: true, presence: false
column title : String?
end
end
# respects schema, works fine
Products::Listing.query.each { |a| puts a.title }
# FAILS tries insert into "listings" without the schema prefix
a = Products::Listing.create(title: "iPhone")
anykeyh commented
Yes, it's a bug.
You might trick the system by naming your table products.listings
.
u89012 commented
Thank you for confirming. That's too bad I can't do that as I'm working with a legacy database. I thought I saw references to self.schema
in the code when I looked up on how to include the schema information for the model. Any chance this will be fixed soon?
anykeyh commented
You can use the v0.9 branch, this has been fixed now.