avram
avram copied to clipboard
Add macro helpers + documentation for supporting materialized views
Per chat in discord:
Current approach:
class ModelName < BaseModel
skip_schema_enforcer
table do
...
end
Ideas:
view :materialized do
end
Not 100% sold on that as it could look like that's how you name the view.... But my thought is, if we can detect that it's a materialized view here, then we can also add a helper method like this:
def self.refresh_view(*, concurrent : Bool = false)
database.exec("REFRESH MATERIALIZED VIEW #{concurrent ? "CONCURRENTLY" : ""} #{table_name}")
end