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

Allow defining columns of the view #66

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

bastien-phi
Copy link
Contributor

When creating a view, it could be useful to define the columns before the query.

create or replace view "test_623632" ("column_449989") as select random()

Real-life use case of this : I want a view to be created as a union query of different tables. Some columns have to be renamed, other defined with static values, ... It would be possible to do it without defining the columns before the query but the syntax of the query would become very heavy.

This syntax is borrowed from staudenmeir/laravel-migration-views (https://github.com/staudenmeir/laravel-migration-views) but the two packages are not compatible.

@tpetry
Copy link
Owner

tpetry commented Oct 4, 2023

The materialized view would need the columns param too to be consistent with the other ones.

@bastien-phi bastien-phi force-pushed the define-columns-in-views branch from 3a63328 to 366b41d Compare October 4, 2023 20:23
@bastien-phi
Copy link
Contributor Author

Here it is !

@tpetry tpetry merged commit cd30ed8 into tpetry:master Oct 10, 2023
20 checks passed
@tpetry
Copy link
Owner

tpetry commented Oct 10, 2023

Thanks for your work Bastien, again. Its released as 0.32.0

@bastien-phi
Copy link
Contributor Author

Always fun to contribute ! Actually, I needed this for my current project 😅

@bastien-phi bastien-phi deleted the define-columns-in-views branch October 10, 2023 06:20
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