CREATE TABLE revisions ( id <%= @pk %>, created_at <%= @datetime %> NOT NULL, updated_at <%= @datetime %> NOT NULL, -- note that continuous edits change the existing last revision, instead of creating one -- revised_at is the timestamp of last edit of this revision -- unlike updated_at is can be set explicitly in a call to Revision.create -- besides, it should not be updated when Revision row changes for any other reason than -- changing content revised_at <%= @datetime %> NOT NULL, page_id INTEGER NOT NULL, content TEXT NOT NULL, author VARCHAR(60), ip VARCHAR(60) ) <%= create_options %>;