update blocks_blocks set block_index = block_index - 1 where community_id = :community_id and block_index > :block_index and block_index < :tmp_block_index update blocks_blocks set block_index = block_index + 1 where community_id = :community_id and block_index >= :tmp_block_index and block_index < :block_index update blocks_blocks set block_index = block_index - 1 where community_id = :community_id and block_index > :block_index and block_index <= :tmp_block_index