Sha256: de950927db453ed30b97d343bbbf3bf63d0f9bb28323a1a7e0a91c28081ef456
Contents?: true
Size: 879 Bytes
Versions: 25
Compression:
Stored size: 879 Bytes
Contents
class InsertMainStorylines < ActiveRecord::Migration def up create_storyline_for_each_revision update_each_chapter_to_reference_a_storyline end private def create_storyline_for_each_revision # We can reuse entry ids as storyline perma ids since all # storylines of an entry's revisions are supposed to have the same # perma id. execute(<<-SQL) INSERT INTO pageflow_storylines (perma_id, revision_id, position, configuration, created_at, updated_at) SELECT entry_id, id, 1, '{"main":true}', created_at, updated_at FROM pageflow_revisions SQL end def update_each_chapter_to_reference_a_storyline execute(<<-SQL) UPDATE pageflow_chapters SET storyline_id = (SELECT id FROM pageflow_storylines WHERE pageflow_storylines.revision_id = pageflow_chapters.revision_id) SQL end end
Version data entries
25 entries across 25 versions & 1 rubygems