class AddVideoMsToPostVersions < ActiveRecord::Migration[8.0]
  def change
    add_column :post_versions, :video_ms, :integer
    add_index :post_versions, [:video_ms, :post_id], name: 'idx_post_versions_video_ms_post_id'

    add_check_constraint :post_versions, 'video_ms IS NULL OR video_ms > 0',
                         name: 'chk_post_versions_video_ms_positive'
  end
end
