-
-
Notifications
You must be signed in to change notification settings - Fork 14
How to create materialized view? #360
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
Comments
Seems like adding an option would be the simplest: orchid-orm/packages/rake-db/src/migration/createView.ts Lines 48 to 50 in c9a3f8a
|
We probably also need a way to refresh the view in js code, without the need to use raw sql |
I'll need to learn this topic and see what's needed besides the
Right, I see there is a |
Some time has passed, and I changed my view (pun intended) on managing views in orchid. Instead of writing a migration with With this approach it's much simpler to keep the view in source control, and updating the view declaration doesn't require creating new migrations every time. Such a great feature! |
Cool, I finally got here to answer that I'm glad you found a way with recurring migrations and raw SQL. When something is missing in the ORM, it's generally possible to bypass it with raw SQL, and eventually I'll cover what's missing with a TypeScript DSL. In this case, it would be ideal to write your views (materialized or not) closer to the app logic, and to be able to rely on view types, and the migration generator should learn how to overwrite views in the recurring directory. |
There's the
createView()
method I can use in migrations, but there's no option to make it a materialized view. How can I create one inside a migration?The text was updated successfully, but these errors were encountered: