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

Support for Materialized columns #127

Open
AlexKichkailo opened this issue Mar 22, 2024 · 2 comments
Open

Support for Materialized columns #127

AlexKichkailo opened this issue Mar 22, 2024 · 2 comments

Comments

@AlexKichkailo
Copy link

AlexKichkailo commented Mar 22, 2024

In ClickHouse, it is possible to define materialized columns for a table.

Is there any way to create a materialized column using create_table?

I imagine the syntax could be similar to the syntax for column default. something like

t.boolean :a
t.boolean :b
t.boolean :c
t.boolean :materialized_column,  materialize: -> { 'a OR b OR c' }
@PNixx
Copy link
Owner

PNixx commented Mar 25, 2024

You can try #55 (comment)

@ericbeland
Copy link

One idea @PNixx --It would be nice to include a way and an example of a plain SQL migration defined in a migrations up and down method using the underlying connection to create a materialized view. I imagine the connection is probably available, although I don't know if I saw any examples of running queries directly.

I'm using a materialized view with a group_by and toStartOfInterval with some data for graphs. This would be a difficult migration to write through ActiveRecord, but it would be nice to keep even plain SQL migrations in the set of migrations to build the database.

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

3 participants