-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Feature Request
Description:
Implement an optional, code-based Domain-Specific Language (DSL) for defining materialized views. This would allow developers to manage view definitions in version-controlled Ruby files (e.g., in db/mat_views/*.rb) as an alternative to using the Admin UI. Coded views are not editable.
Use Case:
Many development teams prefer an 'infrastructure-as-code' approach, where database objects and configurations are versioned and deployed alongside application code. A DSL makes this workflow possible.
Proposed Solution:
- Create a rake task (e.g.,
mat_views:sync_from_dsl) that reads all files indb/mat_views. - Define a DSL syntax, for example:
matview "users_summary" do sql "SELECT id, count(*) FROM users GROUP BY id" refresh :concurrent, cron: "0 * * * *" end - The rake task will parse these files and create or update the corresponding
MatViewDefinitionrecords in the database.
RSpec Tests:
- Create a sample DSL file in the test environment.
- Run the
mat_views:sync_from_dslrake task. - Verify that a
MatViewDefinitionis created in the database with the correct attributes (SQL, schedule, etc.) from the DSL file. - Test that running the task again updates the existing record rather than creating a duplicate.
Checklist:
- I have searched for a similar feature request and didn't find any duplicates.
- I have included all the required information.
- I have tagged the issue with the label "enhancement".
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Backlog