title: ActiveRecord error: SAVEPOINT active_record_1 does not exist
body: <p>The full error is</p>
  
  <pre><code>ActiveRecord::StatementInvalid: Mysql2::Error: SAVEPOINT active_record_1 does not exist: ROLLBACK TO SAVEPOINT active_record_1
  </code></pre>
  
  <p>I am writing a unit test and getting this error whenever I try to create a new ActiveRecord object -- but only after a certain point. This occurs after these lines:</p>
  
  <pre><code>ActiveRecord::Base.connection.execute "DROP TABLE IF EXISTS foo"
  ActiveRecord::Base.connection.execute "CREATE TABLE foo (id INTEGER PRIMARY KEY)"
  </code></pre>
  
  <p>(The table 'foo' will be populated with data if my test succeeds)</p>
  
  <p>Before the above lines, I can write something like</p>
  
  <pre><code>User.create(email =&gt; 'foo@bar.com')
  </code></pre>
  
  <p>and everything works fine. However, if I try writing the above line after my call to <code>ActiveRecord::Base.connection.execute</code>, then I get this <code>SAVEPOINT error</code> described above.  I've also tried putting my execute statements within a transaction, but that didn't help. I'm stumped.</p>
  
  <p>FYI - I'm using Rails 3.2.8</p>