title: Migrate Rails table from belongs_to to has_and_belongs_to_many
body: <p>Currently, I have the <code>users</code> table containing <code>client_id</code> (so, a <code>User belongs_to :client</code>).</p>
  
  <p>We need to support multiple clients associated to a user, so we've implemented a <code>User has_and_belongs_to_many :clients</code> association. For this, we:</p>
  
  <ul>
  <li>created a new <code>clients_users</code> table, with <code>user_id</code> and <code>client_id</code> columns;</li>
  <li>removed <code>client_id</code> from <code>users</code>.</li>
  </ul>
  
  <p>Now, how can we automatically create HABTM records for each <code>client_id</code> we initially had in the <code>users</code> table? We don't want to lose data.</p>
  
  <p>I am not sure where to start since <code>db:migrate</code> shouldn't involve models or associations between them, and executing raw queries might get complicated in my case.</p>