Fills a page's editing history with every state the timeline can draw, so the whole sheet can be looked at without waiting months for the awkward ones to occur naturally.
Two of these states cannot be produced by using the editor at all today:
- an assistant row —
MishkaCmsCore.Runtime.PageBuilder.AiBackendhas no model configured, and itsEchodefault deliberately makes no edits rather than pretending to; - a payload dropped row — that is what retention does to a document after months, or after 500 changes.
Everything is written through the resource's own actions rather than SQL, so the policies, the
validations and the site_id rule all run exactly as they do in the editor. A seed that skipped
them would be a seed that proves nothing.
Run it from an iex -S mix session:
MishkaCmsCore.Dev.HistorySeeds.seed_all() # every page on every site
MishkaCmsCore.Dev.HistorySeeds.seed(page_id) # one page
MishkaCmsCore.Dev.HistorySeeds.clear_all() # take it all back outDevelopment only. It is not called from the application's own seeds.
Summary
Functions
Remove every seeded row and the snapshots behind them.
Seed one page by id, with the ordinary edits that make it worth paging through.
Seed every active page with a full timeline. Returns how many rows were written.
Functions
@spec clear_all() :: {:ok, non_neg_integer()}
Remove every seeded row and the snapshots behind them.
@spec seed(String.t()) :: {:ok, non_neg_integer()} | {:error, term()}
Seed one page by id, with the ordinary edits that make it worth paging through.
@spec seed_all(keyword()) :: {:ok, non_neg_integer()}
Seed every active page with a full timeline. Returns how many rows were written.
full: names one page that additionally gets enough ordinary edits to fill several pages of the
sheet — that is the page to test paging and the note spoiler on. Every other page gets the ten
states, which is what the states are for.