-
Notifications
You must be signed in to change notification settings - Fork 58
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
EctoSource: Use schema prefix, if there is one #67
Conversation
hey there, thanks for the PR! instead of concatenating the prefix to the table, can you pass the prefix to the various database-specific SQL modules, and have them do it? i don't think it's entirely safe to make the assumption that every database is going to handle prefixes the same way. also, could you include some tests? thanks! |
Hi @koudelka, AFAICT Best, |
Okay I've spent some time on it, and porting to Ecto doesn't work great with version 2, especially since we are trying to At the moment, this approach seems correct but hardly feasible. |
From what I can tell, Postgres and Cockroach have the same table name semantics, so it's pretty much the same for both. |
hey, looks great, would you mind adding some tests though? you also mentioned something about porting to Ecto? did you mean porting the queries themselves to Ecto's query DSL, rather than using string fragments? |
Exactly, I tried that on my fork and it worked somewhat okay, but with Ecto 3 it'd be easier for sure. Hope that I get to adding tests later! |
sorry do you mean that you're not going to add tests now? :( |
No I will absolutely, no worries :-) |
@koudelka sorry for the delay, i added integration test coverage for the prefixed case. Let me know if there's anything else that we should add :-) |
assert exit_code == 0 | ||
end | ||
|
||
defp add_prefixed_tables_env(env, prefixed_tables) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of an explicit conditional here, what do you think of doing the matching in the function head instead? like
defp add_prefixed_tables_env(env, true) do
env ++ [{"prefixed_tables", "true"}]
end
defp add_prefixed_tables_env(env, false), do: env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM! If you want you can just push it if you're on it, otherwise I can make the change tomorrow as well 👍
published v1.2.7 on hex, thanks again dude. :) |
Nice, thanks!
…On Wed, Jan 9, 2019, 00:16 Michael Shapiro ***@***.*** wrote:
published v1.2.7 on hex, thanks again dude. :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#67 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABQjiiHboEFrrYQvkBTX1eyI2zwfKVkbks5vBSangaJpZM4ZLxP3>
.
|
If you have a prefixed schema, Honeydew will just use the table name without the prefix that is specified as
@schema_prefix
.This PR makes sure that the prefix is applied correctly.