class AddVideoMsToPosts < ActiveRecord::Migration[8.0]
  def change
    add_column :posts, :video_ms, :integer
    add_index :posts, [:video_ms, :id], name: 'idx_posts_video_ms_id'

    add_check_constraint :posts, 'video_ms IS NULL OR video_ms > 0',
                         name: 'chk_posts_video_ms_positive'
  end
end
