Introducing SQL views via scenic gem

Hey,

one of the draft patches by @kamils-iRonin introduces SQL views via scenic gem. I think it’s a good step forward now when we finally have a single database, but I would like to bring this to attention to the broader group for discussion.

We do have the NullDB database adapter for running migrations/seeds but as long as this status view is not used it should not be any concern.

Opinions?

1 Like

FWIW, I’m all for it.

2 Likes

I don’t mind, but I’m bit worried we might start overusing views. I believe it should come with a description ideally in developer_docs how to use it and what is a good use case to use them.

With that I’m up for it :+1:

How would we go about extending views from plugins? Briefly glancing at the readme it doesn’t really seem doable ootb

1 Like

Good point. I’m not sure if this is doable in an easy way. If you need some view in the plugin, you have to create a new one and you can use core views in your query.

1 Like

Which on the other hand means creating a brand new ActiveRecord model which is not ideal. But IIUC this could be just a subclass with overloaded table_name and a new view which costs almost nothing as long as it is not materialized.

I think I am fine with that.