CREATE VIEW "code_notebook_sql_cell_migratable_state" AS
-- code provenance: `RssdInitSqlNotebook.notebookBusinessLogicViews` (file:///home/baasit/www.surveilr.com/lib/std/lifecycle.sql.ts)
-- All cells that are candidates for migration (latest only)
SELECT
c.*, -- All columns from the code_notebook_sql_cell_migratable view
s.from_state, -- The state the cell transitioned from
s.to_state, -- The state the cell transitioned to
s.transition_reason, -- The reason for the state transition
s.transition_result, -- The result of the state transition
s.transitioned_at -- The timestamp of the state transition
FROM
code_notebook_sql_cell_migratable c
JOIN
code_notebook_state s
ON c.code_notebook_cell_id = s.code_notebook_cell_id
ORDER BY c.cell_name