-
Notifications
You must be signed in to change notification settings - Fork 322
Expose Structure.dump_cmd/3 #423
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
Conversation
[] | ||
) | ||
|
||
assert output =~ "INSERT INTO `schema_migrations` VALUES (" |
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.
@josevalim I did not change anything with how the migrations work. I just took this as an example since I knew how to call it from the PR before.
Thank you! What about tds? |
@josevalim Tds does not implement |
(It also does not look as if there's a management CLI: https://dba.stackexchange.com/questions/273158/how-can-i-dump-the-schema-of-a-sql-server-database-on-linux) EDIT: We could implement it using SQLpackage.exe, but that should be a separate issue / PR I think. |
lib/ecto/adapter/structure.ex
Outdated
@callback dump_cmd( | ||
repo_or_config :: module() | Keyword.t(), | ||
args :: [String.t()], | ||
opts :: Keyword.t() | ||
) :: {output :: Collectable.t(), exit_status :: non_neg_integer()} |
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.
Sorry, there is one last nitpick. Generally speaking, we want to make the adapter behaviour as small as possible. This means we should not receive both Repo and Config. Also, other functions in this module receive the config
as the last opts, so I propose for this to be:
@callback dump_cmd( | |
repo_or_config :: module() | Keyword.t(), | |
args :: [String.t()], | |
opts :: Keyword.t() | |
) :: {output :: Collectable.t(), exit_status :: non_neg_integer()} | |
@callback dump_cmd( | |
args :: [String.t()], | |
opts :: Keyword.t(), | |
config :: Keyword.t() | |
) :: {output :: Collectable.t(), exit_status :: non_neg_integer()} |
And then if you want a more convenient API which is dump_cmd(repo | config, args, opts)
, we can add it to Ecto.Adapters.SQL, but I think we can skip it for now and the low-level one is fine. :)
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.
In other words, let's just change the signature here, update the code, and ship it!!!
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.
@josevalim Ok, I'm on it 👍
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.
@josevalim Changed
💚 💙 💜 💛 ❤️ |
@josevalim Would you like me to create an issue for TDS / |
Follow up from #419 (comment)