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

structured migration options #116

Merged
merged 1 commit into from
Sep 13, 2023
Merged

structured migration options #116

merged 1 commit into from
Sep 13, 2023

Conversation

ruslandoga
Copy link
Contributor

@ruslandoga ruslandoga commented Sep 13, 2023

This PR attempts to add structured migration options as proposed in #115 (comment)

@@ -2065,6 +2102,10 @@ defmodule Ecto.Adapters.ClickHouse.ConnectionTest do
]
end

# TODO?
@tag :skip
test "drop constraint on cluster"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://hexdocs.pm/ecto_sql/Ecto.Migration.Constraint.html doesn't have :options field. We can hack around and pass cluster in :comment though :)

Copy link
Contributor Author

@ruslandoga ruslandoga Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also open a PR into Ecto to add constraint.options

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm relatively new to ClickHouse, so maybe I'm just not fully aware, but according to the docs, constraints are created and dropped using ALTER TABLE statements https://clickhouse.com/docs/en/sql-reference/statements/alter/constraint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that's not the issue. The issue is that we we can't pass any :options to https://hexdocs.pm/ecto_sql/Ecto.Migration.html#constraint/3

@ruslandoga ruslandoga force-pushed the better-migration-options branch 10 times, most recently from 9fc41b8 to a3dee69 Compare September 13, 2023 10:53
@ruslandoga ruslandoga marked this pull request as ready for review September 13, 2023 10:55
@ruslandoga ruslandoga changed the title better migration options structured migration options Sep 13, 2023
@ruslandoga ruslandoga force-pushed the better-migration-options branch from a3dee69 to 7720530 Compare September 13, 2023 11:05
@ruslandoga ruslandoga merged commit b80e0cd into master Sep 13, 2023
@ruslandoga ruslandoga deleted the better-migration-options branch September 13, 2023 12:11
```elixir
table_options = [cluster: "my-cluster"]
engine_options = [order_by: "tuple()"]
optiosn = table_options ++ engine_options

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options (spelling)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

@edwardsmit
Copy link

@ruslandoga this looks great!

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

Successfully merging this pull request may close these issues.

2 participants