I'm working with a legacy schema which has 3 particular tables backing a single class, listed below:
table_1_month
- # All items that are < 1 month old.
table_1_year
- # All items that are between 1 month and 1 year old.
table
- # All items that are older than 1 year.
All 3 tables have the same schemas, but the only difference between them is that the time it was last updated determines which table the rows exist in.
I know Datamapper has the ability to specify different storage_names via the following syntax:
class Klass
storage_name[:default] = "table"
storage_name[:onemonth] = "table_1_month"
storage_name[:oneyear] = "table_1_year"
end
How would I write a query that specifies the repository by which an article is accessed?
(For example, the query to access all rows that are 2 months old would require retrieving and appending all rows from table_1_month
to a subset of the rows in table_1_year
)